public async Task <ActionResult> CreateEdit(Entities.Doctor doctor, IFormFile image) { if (ModelState.IsValid) { try { if (image != null) { doctor.ImagePath = _fileConfig.AddFile(image, "images"); } await _doctorRepository.CreateEdit(doctor); AddMessage("Doctor Save Success-full", true); } catch (Exception e) { AddMessage("Error When Save Doctor"); } } else { AddError(ModelState); } return(RedirectToAction(nameof(Index))); }
private string SaveUserImage() { if (Input.ImagePath == null) { return(null); } return(_fileConfig.AddFile(Input.ImagePath, "images")); }