Esempio n. 1
0
 public static Doctor ToDoctor(DoctorGetModelView viewModel, ApplicationUser applicationUser, Hospital hospital)
 {
     return(new Doctor
     {
         Id = applicationUser.Id,
         FirstName = viewModel.FirstName,
         LastName = viewModel.LastName,
         Speciality = viewModel.Speciality,
         Ward = viewModel.Ward,
         HospitalId = hospital.Id,
         Hospital = hospital
     });
 }
 public IActionResult UpdateInfo([FromBody] DoctorGetModelView doctorGet)
 {
     try
     {
         string doctorId   = Request.Cookies["DoctorId"];
         var    user       = doctorProfileService.GetUserForDoctor(doctorId);
         var    hospitalId = doctorProfileService.GetDoctor(doctorId).HospitalId;
         var    hospital   = doctorProfileService.GetHospital(hospitalId);
         var    doctor     = Mappers.MapperRegisterDoctor.ToDoctor(doctorGet, user, hospital);
         doctorProfileService.UpdateDoctor(doctor);
         doctorProfileService.UpdateEmail(user.Id, doctorGet.Email);
         return(Ok());
     }catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }