示例#1
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));
 }
示例#2
0
        public IActionResult OnPost(int id)
        {
            var temp = membershipData.Delete(id);

            if (temp == null)
            {
                return(RedirectToPage("./NotFound"));
            }
            membershipData.Commit();
            TempData["TempMessage"] = "The membership is deleted!";
            return(RedirectToPage("./List"));
        }
示例#3
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());
        }
示例#4
0
        public IActionResult OnPost(int?id)
        {
            if (id == null)
            {
                return(RedirectToPage("NotFound"));
            }

            if (Membership.Id == 0)
            {
                return(RedirectToPage("./Edit"));
            }

            if (Membership != null)
            {
                Membership = membershipData.DeleteMembership(Membership.Id);
            }
            membershipData.Commit();
            return(RedirectToPage("./List"));
        }
示例#5
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());
        }