public ActionResult EditPartnerProfile(string identifier) { if (Session != null && Session.Contents != null) { AuthenticatedUserInfo authenticatedUserInfo = Session["loggeduser"] as AuthenticatedUserInfo; if (authenticatedUserInfo != null) { UserDTO userDTO = EntityDTOHelper.GetEntityDTO <DAL.User, UserDTO>(new CEUserManager().FindById( int.Parse(DataSecurityTripleDES.GetPlainText(authenticatedUserInfo.UserId)))); PartnerRestaurantViewModel partnerRestaurantViewModel = null; if (((Common.UserTypeEnum)userDTO.UserTypeFlag).HasFlag(Common.UserTypeEnum.PartnerRestaurant)) { partnerRestaurantViewModel = new PartnerRestaurantViewModel() { Id = userDTO.Id, ContactNumber = userDTO.ContactNumber, Email = userDTO.EmailAddress, FirstName = userDTO.FirstName, Surname = userDTO.Surname, Role = Common.UserTypeEnum.PartnerRestaurant.GetDescription() }; } return(View("EditPartnerProfile", partnerRestaurantViewModel)); } } return(View("Error")); }
public ActionResult PartnerRestaurant(PartnerRestaurantViewModel model) { if (Session != null && Session.Contents != null) { AuthenticatedUserInfo authenticatedUserInfo = Session["loggeduser"] as AuthenticatedUserInfo; if (authenticatedUserInfo != null) { UserDTO userDTO = EntityDTOHelper.GetEntityDTO <DAL.User, UserDTO>(new CEUserManager().FindById( int.Parse(DataSecurityTripleDES.GetPlainText(authenticatedUserInfo.UserId)))); PartnerRestaurantViewModel partnerRestaurantViewModel = null; if (((Common.UserTypeEnum)userDTO.UserTypeFlag).HasFlag(Common.UserTypeEnum.PartnerRestaurant)) { partnerRestaurantViewModel = new PartnerRestaurantViewModel() { Id = userDTO.Id, ContactNumber = userDTO.ContactNumber, Email = userDTO.EmailAddress, FirstName = userDTO.FirstName, Surname = userDTO.Surname, Role = Common.UserTypeEnum.PartnerRestaurant.GetDescription() }; } if ((userDTO.AddressId ?? "").Length > 0) { DataProvider dataProvider = new DataProvider(); DAL.Address anAddress = dataProvider.FindAddressById( int.Parse(DataSecurityTripleDES.GetPlainText(userDTO.AddressId))); AddressViewModel addressViewModel = EntityDTOHelper.GetEntityDTO <DAL.Address, AddressViewModel>(anAddress); if (anAddress != null) { DAL.Region region = dataProvider.FindRegionById(anAddress.RegionId ?? 0); if (region != null) { addressViewModel.RegionAlias = region.RegionAlias; addressViewModel.RegionId = DataSecurityTripleDES.GetEncryptedText(region.Id); } partnerRestaurantViewModel.Addresses = new List <AddressViewModel>() { addressViewModel }; } } return(View("PartnerRestaurant", partnerRestaurantViewModel)); } } return(View("Error")); }
public ActionResult EditPartnerProfile(PartnerRestaurantViewModel model, string returnUrl) { try { if (!ModelState.IsValid) { return(View(model)); } CEUserManager ceUserManager = new CEUserManager(); if (model.Id?.Length > 0) { UserDTO userDTO = new UserDTO() { Id = model.Id, FirstName = model.FirstName, Surname = model.Surname, ContactNumber = model.ContactNumber, LastUpdated = DateTime.Now }; ceUserManager.SaveUserDetail(userDTO); return(RedirectToAction("PartnerRestaurant", "Profile")); } ModelState.AddModelError(string.Empty, "Save attempt failed."); //ModelState.AddModelError(string.Empty, "Login attempt failed."); } catch (Exception e) { System.Diagnostics.Trace.WriteLine(e); } return(this.View(model)); }