public IActionResult OnPost(int fitnessPlanId)
        {
            var plan = planData.Delete(fitnessPlanId);

            planData.Commit();

            if (plan == null)
            {
                return(RedirectToPage("./NotFound"));
            }

            TempData["Message"] = "Fitness Plan Deleted";
            return(RedirectToPage("./List"));
        }
Beispiel #2
0
 public IActionResult OnPost()
 {
     if (!ModelState.IsValid)
     {
         return(Page());
     }
     if (FitnessPlan.Id > 0)
     {
         planData.Update(FitnessPlan);
     }
     else
     {
         planData.Add(FitnessPlan);
     }
     planData.Commit();
     TempData["Message"] = "Data saved!";
     return(RedirectToPage("./Detail", new { fitnessPlanId = FitnessPlan.Id }));
 }