Ejemplo n.º 1
0
        public ActionResult EditModel(CoffeLakeMenu model)
        {
            var db      = new CoffeLakeContainer();
            var element = db.CoffeLakeMenuSet.Where(x => x.Id == model.Id).FirstOrDefault();

            if (element != null)
            {
                element.Caption        = model.Caption;
                element.Price          = model.Price;
                element.MenuCategoryId = model.MenuCategoryId;
            }
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 2
0
        public ActionResult CreateModel(CoffeLakeMenu model)
        {
            var db      = new CoffeLakeContainer();
            var element = new CoffeLakeMenu();

            element.Caption        = model.Caption;
            element.Price          = model.Price;
            element.Description    = model.Description;
            element.MenuCategoryId = model.MenuCategoryId;

            db.CoffeLakeMenuSet.Add(element);
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }