public async Task <IActionResult> Save(TrainerViewModel viewModel, IFormFile uploadedFile) { if (uploadedFile != null) { if (await _uploadFileService.UploadFileAsync(uploadedFile, "/images/upload/trainers")) { viewModel.Trainer.Photo = $"images/upload/trainers/{uploadedFile.FileName}"; } } if (_dataManager.Trainers.SaveTrainer(viewModel.Trainer)) { return(RedirectToAction("Index")); } return(View(viewModel)); }
public async Task <IActionResult> UploadCKEditor(IFormFile upload) { if (await _uploadFileService.UploadFileAsync(upload, "/images/upload/services/")) { return(new JsonResult(new { uploaded = 1, fileName = upload.FileName, url = $"/images/upload/services/{upload.FileName}" })); } return(new JsonResult(new { uploaded = 0 })); }