public ActionResult Create(ProfilesEditViewModels model) { try { if (ModelState.IsValid) { // TODO: Add insert logic here var profiles = new ProfilesHelper(); var profile = new Profile() { FirstName = model.FirstName, LastName = model.LastName, Address = model.Address, UserId = User.Identity.GetUserId(), DOB = model.DoB, GenderId = (int)model.Gender, Telephone = model.Telephone }; profiles.Add(profile); return RedirectToAction("Details"); } return View(model); } catch(Exception ex) { return View(); } }
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(); } }