Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Settings
- [AllowAnonymous]
- public ActionResult Settings()
- {
- return View();
- }
- [HttpPost]
- [AllowAnonymous]
- [ValidateAntiForgeryToken]
- public ActionResult Settings(RegisterViewModel model)
- {
- if (!ModelState.IsValid)
- {
- ViewBag.Msg = "Nieprawidłowe dane";
- return View();
- }
- else
- {
- ModelState.Clear();
- }
- try
- {
- var currentUserId = System.Web.HttpContext.Current.Session["CurrentUser"] as string ?? "unauthorized";
- var repo = new Repository<UserProfile>(new ProjectDataBase());
- var user = new DomainModel.UserProfile()
- {
- FirstName = model.FirstName,
- LastName = model.LastName,
- //BirthDate = model.BirthDate,
- Sex = model.Sex,
- City = model.City,
- MaritalStatus = model.MaritalStatus,
- Password = model.Password,
- LoginEmail = model.Email
- };
- if (currentUserId != "unauthorized")
- {
- repo.Edit(user);
- ViewBag.Msg = "Zmiany zostały zapisane";
- return View();
- }
- ViewBag.Msg = "Użytkownik nie zalogowany";
- return View();
- }
- catch
- {
- ViewBag.Msg = "Błąd";
- }
- return View();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement