Example #1
0
 public ActionResult EditProfile(DoctorModel model)
 {
     if (ModelState.IsValid)
     {
         var profile = new Doctor();
         profile.FirstName = model.FirstName;
         profile.LastName = model.LastName;
         profile.Gender = model.Gender;
         profile.MobileNumber = model.MobileNumber;
         profile.Age = model.Age;
         profile.Specialization = model.Specialization;
         _doctorService.EditProfile(profile, User.Identity.Name);
         //address
         var address = new Address();
         address.HouseNo = model.HouseNo;
         address.RoadNo = model.RoadNo;
         address.Thana = model.Thana;
         address.Zilla = model.Zilla;
         _doctorService.UpdateAddress(address, User.Identity.Name);
         Session["Success"] = "Profile Updated Successfully";
     }
     else
     {
         Session["Error"] = "Sorry, Profile Cannot Be Updated";
     }
     return View(model);
 }
Example #2
0
 public void EditProfile(Doctor doctor, string userName)
 {
     _doctorRepository.Update(doctor, _userRepository.GetUserId(userName));
 }
Example #3
0
 public bool SaveProfile(Doctor doctor, String email)
 {
     doctor.UserId = _userRepository.GetUserId(email);
     return _doctorRepository.Add(doctor);
 }
Example #4
0
        public ActionResult Register(RegisterModel model)
        {
            if (ModelState.IsValid)
            {
                bool status = _accountService.ValidateRegistration(model.Email);
                if (status)
                {
                    FormsAuthentication.SetAuthCookie(model.Email, false);
                    _user.Password = model.Password;
                    _user.Email = model.Email;
                    _user.Role = model.Role;
                    _accountService.SaveUser(_user);
                    if (model.Role.Equals("Doctor"))
                    {
                        var doctor = new Doctor();
                        doctor.LastName = model.LastName;
                        doctor.FirstName = model.FirstName;
                        doctor.MobileNumber = model.MobileNumber;
                        _doctorService.SaveProfile(doctor, model.Email);
                        _doctorService.SaveAddress(new Address(), model.Email);
                        _doctorService.SaveSchedule(new Schedule(), model.Email);
                    }
                    Session["Success"] = "Registration Successful";

                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    ModelState.AddModelError("", "User Name already exists");
                    Session["Error"] = "Registration Failure";
                    return RedirectToAction("Register", "Account");
                }

            }
            return RedirectToAction("Register", "Account");
        }