private ObjectResult GetImageSaveErrorResult(SaveImageError error) { var errorCode = GetImageSaveErrorCode(error); var apiErrorDataContract = new ApiErrorDataContract(errorCode); return(BadRequest(apiErrorDataContract)); }
private static string GetImageSaveErrorCode(SaveImageError error) { switch (error) { case SaveImageError.EmptyFilePath: return(SaveImageApiErrorCodes.EmptyFilePath); case SaveImageError.TooBigImage: return(SaveImageApiErrorCodes.TooBigFile); case SaveImageError.NotAllowedMediaType: return(SaveImageApiErrorCodes.NotAllowedMediaType); default: throw new ArgumentOutOfRangeException(nameof(error), error, null); } }
private SaveImageResult(bool isSuccessful, SaveImageError error, string externalId) { IsSuccessful = isSuccessful; Error = error; ExternalId = externalId; }