Esempio n. 1
0
        public ActionResult Specials()
        {
            AdminSpecialsVM VM   = new AdminSpecialsVM();
            var             repo = new SpecialRepositoryADO();

            VM.Specials = repo.ReadAllSpecials();
            return(View(VM));
        }
Esempio n. 2
0
        public ActionResult Specials(AdminSpecialsCM form, int id)
        {
            if (ModelState.IsValid)
            {
                AdminSpecialsVM VM      = new AdminSpecialsVM();
                Specials        special = new Specials();
                var             repo    = new SpecialRepositoryADO();
                special.Title       = form.Title;
                special.Description = form.Description;
                repo.CreateSpecial(special);
                repo.DeleteSpecial(special);

                //return View(VM);
                return(RedirectToAction("Specials"));
            }
            else
            {
                AdminSpecialsVM VM   = new AdminSpecialsVM();
                var             repo = new SpecialRepositoryADO();

                VM.Form = form;
                return(View(VM));
            }
        }