public async Task <JsonNetResult> GenerateUploadDestination(GenerateUploadDestinationViewModel model) { // Generate a destination for the upload UploadDestination uploadDestination = await _uploads.GenerateUploadDestination(new GenerateUploadDestination { FileName = model.FileName }); if (uploadDestination.ErrorMessage != null) { ModelState.AddModelError(string.Empty, uploadDestination.ErrorMessage); return(JsonFailure()); } // Return the Id and the URL where the file can be uploaded return(JsonSuccess(new UploadDestinationViewModel { UploadUrl = uploadDestination.UploadUrl })); }