// GET: Profiles/Details/5 public ActionResult Details() { var user = User.Identity.GetUser(true); var profile = user.Profile; if (profile == null) { return RedirectToAction("Create", "Profile"); } ProfilesDetailsViewModels model = new ProfilesDetailsViewModels() { FirstName = profile.FirstName, LastName = profile.LastName, Address = profile.Address, DoB = profile.DOB, Gender = (GenderType)Enum.ToObject(typeof(GenderType), profile.GenderId), Telephone = profile.Telephone }; var profiles = new ProfilesHelper(); profiles.Update(profile); return View(model); }
public ActionResult Edit(ProfilesEditViewModels model) { try { if (ModelState.IsValid) { var profiles = new ProfilesHelper(); var profile = new Profile() { UserId = User.Identity.GetUserId(), FirstName = model.FirstName, LastName = model.LastName, Address = model.Address, DOB = model.DoB, GenderId = (int)model.Gender, Telephone = model.Telephone }; profiles.Update(profile); return RedirectToAction("Details"); } return View(model); } catch { return View(); } }