public ActionResult BasicInformation() { if (Session["UserId"] != null) { int UserId = Convert.ToInt32(Session["UserId"].ToString()); UserDetail Userdata = UserService.Get(UserId); DateTime? dts = Userdata.DOB; string formatted = String.Format("{0:dd/MM/yyyy}", dts); ProfileBasicInformation BasicProfile = new ProfileBasicInformation() { FirstName = Userdata.FirstName, LastName = Userdata.LastName, DOB = Userdata.DOB, Salutation = SaluationService.GetSaluations(), //States = StatecitydistrictService.GetAllStates(), SalutationId = Userdata.SalutationId, GenderId = Convert.ToInt32(Userdata.GenderId), ProfilePicture = Userdata.ProfilePicture }; return(View(BasicProfile)); } return(RedirectToAction("Login", "Account")); }
public ActionResult BasicInformation(ProfileBasicInformation RegisterDTO, HttpPostedFileBase ProfilePicture) { if (Session["UserId"] != null) { int UserId = Convert.ToInt32(Session["UserId"].ToString()); var FilePath = ""; if (ProfilePicture != null) { var fileName = Path.GetFileName(ProfilePicture.FileName); var path = Path.Combine(Server.MapPath("~/UserProfilePictures/" + fileName)); // model.ImageServerPath = path; ProfilePicture.SaveAs(path); FilePath = "/UserProfilePictures/" + fileName; } UserDetail UpdateUserData = new UserDetail() { FirstName = RegisterDTO.FirstName, LastName = RegisterDTO.LastName, SalutationId = RegisterDTO.SalutationId, GenderId = RegisterDTO.GenderId, DOB = DateTime.Parse(RegisterDTO.DateofBirth, new CultureInfo("en-CA")), ProfilePicture = FilePath }; UserInfoService.UpdateBasicInformation(UserId, UpdateUserData); TempData["Success"] = UtilitiesClass.SuccessMessage; return(RedirectToAction("Profile", "Profile", new { area = "Alumini" })); UserDetail Userdata = UserInfoService.Get(UserId); ProfileBasicInformation BasicProfile = new ProfileBasicInformation() { FirstName = Userdata.FirstName, LastName = Userdata.LastName, DOB = Userdata.DOB, Salutation = SalutationService.GetSaluations(), //States = StatecitydistrictService.GetAllStates(), SalutationId = Userdata.SalutationId, GenderId = Convert.ToInt32(Userdata.GenderId), ProfilePicture = Userdata.ProfilePicture, }; return(View(BasicProfile)); } return(RedirectToAction("Login", "Account", new { area = "" })); }
public ActionResult BasicInformation() { if (Session["UserId"] != null) { int UserId = Convert.ToInt32(Session["UserId"].ToString()); UserDetail Userdata = UserInfoService.Get(UserId); ProfileBasicInformation BasicProfile = new ProfileBasicInformation() { FirstName = Userdata.FirstName, LastName = Userdata.LastName, DOB = Userdata.DOB, Salutation = SalutationService.GetSaluations(), //States = StatecitydistrictService.GetAllStates(), SalutationId = Userdata.SalutationId, GenderId = Convert.ToInt32(Userdata.GenderId), ProfilePicture = Userdata.ProfilePicture }; return View(BasicProfile); } return RedirectToAction("Login", "Account", new { area = "" }); }
public ActionResult BasicInformation(ProfileBasicInformation RegisterDTO, HttpPostedFileBase ProfilePicture) { if (Session["UserId"] != null) { int UserId = Convert.ToInt32(Session["UserId"].ToString()); var FilePath = ""; if (ProfilePicture != null) { var fileName = Path.GetFileName(ProfilePicture.FileName); var path = Path.Combine(Server.MapPath("~/UserProfilePictures/" + fileName)); // model.ImageServerPath = path; ProfilePicture.SaveAs(path); FilePath = "/UserProfilePictures/" + fileName; } UserDetail UpdateUserData = new UserDetail() { FirstName = RegisterDTO.FirstName, LastName = RegisterDTO.LastName, SalutationId = RegisterDTO.SalutationId, GenderId = RegisterDTO.GenderId, DOB = DateTime.Parse(RegisterDTO.DateofBirth, new CultureInfo("en-CA")), ProfilePicture = FilePath }; UserInfoService.UpdateBasicInformation(UserId, UpdateUserData); TempData["Success"] = UtilitiesClass.SuccessMessage; return RedirectToAction("Profile", "Profile", new { area = "Alumini" }); UserDetail Userdata = UserInfoService.Get(UserId); ProfileBasicInformation BasicProfile = new ProfileBasicInformation() { FirstName = Userdata.FirstName, LastName = Userdata.LastName, DOB = Userdata.DOB, Salutation = SalutationService.GetSaluations(), //States = StatecitydistrictService.GetAllStates(), SalutationId = Userdata.SalutationId, GenderId = Convert.ToInt32(Userdata.GenderId), ProfilePicture = Userdata.ProfilePicture, }; return View(BasicProfile); } return RedirectToAction("Login", "Account", new { area = "" }); }