Beispiel #1
0
        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)));
        }
Beispiel #2
0
 private string SaveUserImage()
 {
     if (Input.ImagePath == null)
     {
         return(null);
     }
     return(_fileConfig.AddFile(Input.ImagePath, "images"));
 }