Beispiel #1
0
        public async Task <IActionResult> EditDoctorProfile(DoctorEditProfileModel model)
        {
            var result = await _accountService.EditDoctor(model.Id, model.FirstName, model.LastName, model.EGN, model.PhoneNumber, model.BirthDate, model.Gender);

            if (result.Succeeded)
            {
                return(RedirectToAction("DoctorProfile", "Account", new { id = model.Id }));
            }

            foreach (var err in result.Errors)
            {
                ModelState.AddModelError("", err);
            }

            return(RedirectToAction("EditDoctorProfile", "Account", new { doctorId = model.Id }));
        }
Beispiel #2
0
        public async Task <IActionResult> EditDoctorProfile(string doctorId)
        {
            var doctor = await _accountService.GetDoctor(doctorId);

            var model = new DoctorEditProfileModel()
            {
                Id          = doctor.Id,
                FirstName   = doctor.FirstName,
                LastName    = doctor.LastName,
                EGN         = doctor.EGN,
                PhoneNumber = doctor.PhoneNumber,
                Gender      = doctor.Gender,
                BirthDate   = doctor.BirthDate,
                Genders     = new string[] { "Mъж", "Жена" }
            };

            return(View("EditProfileDoctor", model));
        }