public IActionResult OnPost() { if (ModelState.IsValid) { if (MembershipExists(Membership.Id) == false) { Membership = membershipData.CreateMembership(Membership); } else { Membership = membershipData.Update(Membership); } membershipData.Commit(); return(RedirectToPage("./List")); } return(Page()); }
public IActionResult Edit(MembershipsEditViewModel model) { if (ModelState.IsValid) { if (model.Membership.Id == 0) { model.Membership = membershipData.Create(model.Membership); TempData["TempMessage"] = "New membership is created!"; } else { model.Membership = membershipData.Update(model.Membership); TempData["TempMessage"] = "Membership terms are updated!"; } membershipData.Commit(); return(RedirectToAction("List")); } return(View(model)); }
public IActionResult OnPost() { if (ModelState.IsValid) { if (Membership.Id == 0) { Membership = membershipData.Create(Membership); TempData["TempMessage"] = "New membership is created!"; } else { Membership = membershipData.Update(Membership); TempData["TempMessage"] = "Membership terms are updated!"; } membershipData.Commit(); return(RedirectToPage("./List")); } return(Page()); }