public ActionResult Edit(DinnerInput input)
        {
            if (!ModelState.IsValid) return PartialView("Create", input);
            var dinner = Db.Get<Dinner>(input.Id);

            dinner.Name = input.Name;
            dinner.Date = input.Date.Value;
            dinner.Chef = Db.Get<Chef>(input.Chef);
            dinner.Meals = Db.Meals.Where(m => input.Meals.Contains(m.Id));
            dinner.BonusMealId = input.BonusMealId;
            Db.Update(dinner);

            // returning the key to call grid.api.update
            return Json(new { dinner.Id });
        }
        public ActionResult Create(DinnerInput input)
        {
            if (!ModelState.IsValid) return PartialView(input);

            var dinner = Db.Insert(new Dinner
            {
                Name = input.Name,
                Date = input.Date.Value,
                Chef = Db.Get<Chef>(input.Chef),
                Meals = Db.Meals.Where(o => input.Meals.Contains(o.Id)),
                BonusMealId = input.BonusMealId
            });

            return Json(MapToGridModel(dinner)); // returning grid model, used in grid.api.renderRow
        }
        public ActionResult Edit(int id)
        {
            var dinner = Db.Get<Dinner>(id);

            var input = new DinnerInput
            {
                Id = dinner.Id,
                Name = dinner.Name,
                Chef = dinner.Chef.Id,
                Date = dinner.Date,
                Meals = dinner.Meals.Select(o => o.Id),
                BonusMealId = dinner.BonusMealId
            };

            return PartialView("Create", input);
        }