//Added by vishal 16-Oct-2016 #region Member public long AddMember(MemberProfileDTO addressDto) { Mapper.Initialize(cfg => cfg.CreateMap <MemberProfileDTO, MemberProfile>()); return(uow.MemberProfileRepo.Add(Mapper.Map <MemberProfileDTO, MemberProfile>(addressDto)).Id); }
public void UpdateMember(MemberProfileDTO addressDto) { Mapper.Initialize(cfg => cfg.CreateMap <MemberProfileDTO, MemberProfile>()); uow.MemberProfileRepo.Update(Mapper.Map <MemberProfileDTO, MemberProfile>(addressDto)); }
public async Task <ActionResult> Register(RegisterViewModel model) { string message = string.Empty; if (ModelState.IsValid) { var user = new IdentityUser { UserName = model.Email, Email = model.Email }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { user = await UserManager.FindByNameAsync(model.Email); #region (Adding To Role) string selectedRoleName = RoleManager.FindById(model.SelectedUserRoleId).Name; UserManager.AddToRole(user.Id, selectedRoleName); #endregion #region (Add Profile) #region (Add Profile) // await SignInManager.SignInAsync(user, isPersistent:false, rememberBrowser:false); //DoctorService doctorService = new DoctorService(); //if (1==1)//(selectedRoleName == CustomRoles.Doctor) //{ // DoctorDTO doctor = new DoctorDTO(); // doctor.FirstName = ""; // doctor.LastName = ""; // doctor.Description = ""; // doctor.DOB = new DateTime(1900, 1, 1); // doctor.LicenseNumber = ""; // doctor.StatusID_FK = 0; // doctor.User_FK_Id = user.Id; // var docId = doctorService.AddDoctor(doctor); //} #endregion MemberProfileService memberProfileService = new MemberProfileService(); MemberProfileDTO member = new MemberProfileDTO(); member.FirstName = ""; member.LastName = ""; member.HighestEducation = ""; member.HomeDistrict = ""; member.MobilePhone = ""; member.Experience = 0; member.DOB = new DateTime(1900, 1, 1); member.FK_FROM_IdentityUser = user.Id; memberProfileService.AddMember(member); #endregion #region (Sending Email) var code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id); var callbackUrl = Url.Action( "ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking this link: <a href=\"" + callbackUrl + "\">link</a>"); //await UserManager.SendEmailAsync(20, // "New Doctor Registration", // "His Email is " + model.Email + ". Please confirm his account by clicking this link: <a href=\"" // + callbackUrl + "\">link</a> Go to <a href='https://amardoctors.com'>Amardoctors</a>"); #endregion return(RedirectToAction("Confirm", "Account", new { Email = user.Email })); } foreach (var item in result.Errors) { message += item + " || "; } AddErrors(result); } // If we got this far, something failed, redisplay form return(RedirectToAction("Register", new { message = message })); }