public ActionResult AddPromo(Promotion NewPromo) { PromotionRepoADO repoP = new PromotionRepoADO(); PromotionsVM model = new PromotionsVM(); if (string.IsNullOrWhiteSpace(NewPromo.PromotionName) || string.IsNullOrWhiteSpace(NewPromo.Description)) { ModelState.AddModelError("", "Promotion name and description must contain text"); } if (ModelState.IsValid) { repoP.AddPromotion(NewPromo); model.Allpromotions = repoP.GetALLpromotions(); model.ValidPromotions = repoP.GetValidPromotions(); return(RedirectToAction("Promotions")); } else { model.Allpromotions = repoP.GetALLpromotions(); model.ValidPromotions = repoP.GetValidPromotions(); model.NewPromo = NewPromo; return(View("Special", model)); } }
public ActionResult Promotions() { PromotionsVM model = new PromotionsVM(); PromotionRepoADO repoP = new PromotionRepoADO(); model.Allpromotions = repoP.GetALLpromotions(); model.ValidPromotions = repoP.GetValidPromotions(); return(View("Special", model)); }