예제 #1
0
        public ActionResult Edit([FromRoute] int id, [Bind("Name")] Restaurant restaurant)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var libRest = new Lib.Restaurant
                    {
                        Id   = id,
                        Name = restaurant.Name
                    };
                    Repo.UpdateRestaurant(libRest);
                    Repo.Save();

                    return(RedirectToAction(nameof(Index)));
                }
                return(View(restaurant));
            }
            catch (Exception ex)
            {
                return(View(restaurant));
            }
        }
예제 #2
0
        public void UpdateRestaurant(Models.Restaurant restaurant)
        {
            var rest = LibraryToDataRestaurant(restaurant);

            crud.UpdateRestaurant(rest);
        }