private LoadImageResult(bool isSuccessful, LoadImageError error, string filePath, string fileMediaType) { IsSuccessful = isSuccessful; Error = error; FilePath = filePath; FileMediaType = fileMediaType; }
private ObjectResult GetImageLoadErrorResult(LoadImageError error) { return(error switch { LoadImageError.IncorrectExternalId => NotFound(new ErrorResponse("Incorrect image id")), LoadImageError.ImageNotExists => StatusCode(500, new ErrorResponse("Internal error. Image wasn't found")), _ => throw new ArgumentOutOfRangeException(nameof(error), error, null), });
private ObjectResult GetImageLoadErrorResult(LoadImageError error) { switch (error) { case LoadImageError.IncorrectExternalId: { var apiErrorDataContract = new ApiErrorDataContract(LoadImageApiErrorCodes.IncorrectExternalId); return(NotFound(apiErrorDataContract)); } case LoadImageError.ImageNotExists: { var apiErrorDataContract = new ApiErrorDataContract(GenericApiErrorCodes.UnknownError); return(StatusCode(500, apiErrorDataContract)); } default: throw new ArgumentOutOfRangeException(nameof(error), error, null); } }