This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ExceptionName : Exception | |
{ | |
public ExceptionName() { } | |
public ExceptionName(string message) : base(message) { } | |
public ExceptionName(string message, Exception innerException) : base(message, innerException) { } | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ImageFile : ValidationAttribute | |
{ | |
private readonly string[] _allowedExtensions = { ".png", ".jpeg", ".gif" }; | |
public override bool IsValid(object value) | |
{ | |
if (value is IFormFile file) | |
{ | |
var fileExtension = System.IO.Path.GetExtension(file.FileName).ToLower(); | |
if (!_allowedExtensions.Contains(fileExtension)) |