示例#1
0
        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());
        }
示例#2
0
 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));
 }
示例#3
0
        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());
        }