Пример #1
0
        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;
        }
Пример #2
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));
 }
Пример #3
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));
 }
Пример #4
0
 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"));
 }