public new ActionResult ProfileEdit(DoctorProfileModel model) { if (model != null) { model = new DoctorProfileModel() { Id = 1, FullName = model.FullName, Address = model.Address, Age = model.Age, BloodGroup = model.BloodGroup, Email = model.Email, Gender = model.Gender, Phone = model.Phone, Specialist = model.Specialist, Location = model.Location, OldFee = model.OldFee, NewFee = model.NewFee, CreatedDate = DateTime.UtcNow, UpdatedDate = DateTime.UtcNow, Password = model.Password }; _doctorProfileService.Update(model); return(RedirectToAction("Index", "Doctor")); } return(View()); }
public bool SaveProfile(DoctorProfileModel dpm) { string userId = User.GetId(); bool result = _applicationOperatorRepository.SaveDoctorProfile(dpm, userId); return(result); }
public ActionResult EditProfile() { var user = _applicationOperatorRepository.GetDoctorDetails(User.GetId()); DoctorProfileModel dpVM = new DoctorProfileModel(); if (user != null) { dpVM = new DoctorProfileModel { Email = user.Email, FirstName = user.ApplicationClients != null ? user.ApplicationClients.FirstName : string.Empty, LastName = user.ApplicationClients != null ? user.ApplicationClients.LastName : string.Empty, PhoneNumber = user.PhoneNumber //FirstName = user. }; } return(View("EditProfile", dpVM)); }
public ActionResult Registration(RegistrationViewModel model) { if (ModelState.IsValid) { if (model.Type == "Doctor") { DoctorProfileModel doctor = new DoctorProfileModel(); doctor.FullName = model.Name; doctor.Email = model.Email; doctor.Password = model.Password; doctor.Gender = "Female"; doctor.Specialist = "Dentist"; doctor.Location = "Rajshahi"; doctor.Phone = "017XXXXXXXX"; doctor.NewFee = 1000; doctor.OldFee = 750; _doctorProfileService.Insert(doctor); return(RedirectToAction("Login", "Account")); } else if (model.Type == "Patient") { PatientProfileModel patient = new PatientProfileModel(); patient.Name = model.Name; patient.Email = model.Email; patient.Password = model.Password; patient.Gender = "Female"; patient.BloodGroup = "B+"; patient.District = "Dhaka"; _patientProfileService.Insert(patient); return(RedirectToAction("Login", "Account")); } return(RedirectToAction("Login", "Account")); } else { return(View(model: model)); } }
public bool SaveDoctorProfile(DoctorProfileModel doctorProfileModel, string userId) { ApplicationOperator applicationOperator = null; using (var ctx = new ApplicationDbContext()) { // applicationOperator = GetDoctorDetails(userId); ctx.Configuration.ProxyCreationEnabled = true; ctx.Configuration.LazyLoadingEnabled = true; applicationOperator = ctx.Users.Include(x => x.ApplicationClients).Include(x => x.Professtionals).FirstOrDefault(x => x.Id == userId); applicationOperator.PhoneNumber = doctorProfileModel.PhoneNumber; if (applicationOperator.ApplicationClients != null) { applicationOperator.ApplicationClients.FirstName = doctorProfileModel.FirstName; applicationOperator.ApplicationClients.LastName = doctorProfileModel.LastName; } ctx.Entry(applicationOperator).CurrentValues.SetValues(applicationOperator); ctx.SaveChanges(); } return(true); }
public ActionResult Registration(RegistrationViewModel model) { bool statusRegistration = false; string messageRegistration = string.Empty; if (ModelState.IsValid) { // Email Verification string userName = Membership.GetUserNameByEmail(model.Email); if (!string.IsNullOrEmpty(userName)) { ModelState.AddModelError("Warning Email", "Sorry: Email already Exists"); return(View(model)); } //Save User Data using (TransactionScope scope = new TransactionScope()) { try { var user = new User() { Username = model.Name, Email = model.Email, Password = model.Password, ActivationCode = Guid.NewGuid(), IsActive = true }; int UserId = _helper.CreateUser(user); int RoleId = _helper.GetRoleIdByRoleName(model.Type); _helper.CreateRole(UserId, RoleId); if (model.Type == "Doctor") { DoctorProfileModel doctor = new DoctorProfileModel(); doctor.FullName = model.Name; doctor.Email = model.Email; doctor.Password = model.Password; //doctor.Gender = "Female"; //doctor.Specialist = "Dentist"; //doctor.Location = "Rajshahi"; //doctor.Phone = "017XXXXXXXX"; //doctor.NewFee = 1000; //doctor.OldFee = 750; _doctorProfileService.Insert(doctor); scope.Complete(); return(RedirectToAction("Login", "Account")); } else if (model.Type == "Patient") { PatientProfileModel patient = new PatientProfileModel(); patient.Name = model.Name; patient.Email = model.Email; patient.Password = model.Password; //patient.Gender = "Female"; //patient.BloodGroup = "B+"; //patient.District = "Dhaka"; _patientProfileService.Insert(patient); scope.Complete(); return(RedirectToAction("Login", "Account")); } else { return(null); } } catch (Exception ex) { // Log error scope.Dispose(); throw ex; } } ////Verification Email //messageRegistration = "Your account has been created successfully. ^_^"; //statusRegistration = true; } else { messageRegistration = "Something Wrong!"; return(View(model)); } ViewBag.Message = messageRegistration; ViewBag.Status = statusRegistration; }