Пример #1
0
        public ActionResult IndexVM()
        {
            var model = new BeerIndexVM();

            model.Beers.ToList();

            return Json(model, JsonRequestBehavior.AllowGet);
        }
Пример #2
0
        public ActionResult Index()
        {
            var model = new BeerIndexVM();

               model.Beers.ToList();

            return View(model);
        }
Пример #3
0
        public ActionResult IndexVM()
        {
            // This is for testing purposes
            // I have used Google Chrome extension that shows Json objects

            var model = new BeerIndexVM();

            model.Beers.ToList();

            return Json(model, JsonRequestBehavior.AllowGet);
        }
Пример #4
0
        public ActionResult Delete(int id)
        {
            var model = new BeerIndexVM();

            var existing = model.Beers.FirstOrDefault(x => x.Id == id);

            if(existing != null)
            {
                    model.Beers.Remove(existing);

            }

            return RedirectToAction("Index","Home");
        }
Пример #5
0
        public ActionResult Edit(BeerEditVM model)
        {
            //This thread we sleep for a small fraction of time to see the Ladda to take effect
            Thread.Sleep(2000);

            var model1 = new BeerIndexVM();

            var beer = new Beer()
            {
                //The ID I hard coded for testing purposes
                Id = 9568369+1,
                Name = model.Name,
                Colour = model.Colour,
                HasTried = model.HasTried

            };

            model1.Beers.Add(beer);

            return Json(beer, JsonRequestBehavior.AllowGet);
        }