Exemple #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));
 }
        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"));
        }
Exemple #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());
        }
Exemple #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"));
        }
        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());
        }