public void ConvertFromSpecialInputModel(SpecialInputModel m) { SpokenLanguage = m.SpokenLanguage; Speaker = m.Speaker; Titel = m.Titel; Omschrijving = m.Omschrijving; Highlight = m.Highlight; ItemID = m.ItemID; ItemAfbeelding = m.ItemAfbeelding; OverviewAfbeelding = m.OverviewAfbeelding; }
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)); }
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)); }
public ActionResult EditSpecial(int?id) { //Get Special if (id != null) { Special special = db.GetSpecial(id.Value); if (special != null) { SpecialInputModel spc = new SpecialInputModel(); spc.ConvertToSpecialInputModel(special); return(View(spc)); } } return(RedirectToAction("ManagementWindow")); }