示例#1
0
 public ActionResult AddSpecial(SpecialInputModel s, string afbLink, string afbLinkOverview)
 {
     if (ModelState.IsValid)
     {
         Special spc = new Special();
         spc.ConvertFromSpecialInputModel(s); //Maak een Special van de input
         spc.ItemAfbeelding     = new Afbeelding(spc.ItemID, null, null, afbLink, "specialbanner");
         spc.OverviewAfbeelding = new Afbeelding(spc.ItemID, null, null, afbLinkOverview, "specialoverview");
         db.AddSpecial(spc);
         return(RedirectToAction("ManagementWindow"));
     }
     return(View(s));
 }
示例#2
0
 public ActionResult EditSpecial(SpecialInputModel special)
 {
     if (ModelState.IsValid)
     {
         Special spcToEdit = db.GetSpecial(special.ItemID);
         spcToEdit.ConvertFromSpecialInputModel(special); //Make special from input model
         db.UpdateSpecial(spcToEdit);
     }
     else
     {
         ModelState.AddModelError("edit-error", "The Special you tried to edit had some incorrectly filled fields.");
     }
     return(View(special));
 }