public ActionResult Create(RestaurantModel restaurantmodel) { log.InfoFormat("[RestaurantsController.Create] RestaurantModel={0}", restaurantmodel.ToString()); if (ModelState.IsValid) { m_serviceLayer.AddRestaurantToDB(restaurantmodel); return RedirectToAction("Index"); } return View(restaurantmodel); }
public ActionResult Edit(RestaurantModel restaurantmodel) { log.InfoFormat("[RestaurantsController.Edit] RestaurantModel={0}", restaurantmodel.ToString()); ModelState.Remove("Adress.BuildingNum"); //ModelState.Remove("Phone"); if (ModelState.IsValid) { RestaurantBasicData rest = restaurantmodel.ToRestaurantBasicModel(); RestaurantBasicData dbRest = m_serviceLayer.GetRestaurantBasicById(restaurantmodel.Id); rest.Menu = dbRest.Menu; //save existed menu CuisineMapServices cuisineMapServ = new CuisineMapServices(); cuisineMapServ.CuisineMapSearch(rest); m_serviceLayer.UpdateRestaurant(rest); return RedirectToAction("Details", new { id = rest.Id } ); } return View(restaurantmodel); }
public ActionResult Edit(RestaurantModel restaurantmodel) { log.InfoFormat("[RestaurantsController.Edit] RestaurantModel={0}", restaurantmodel.ToString()); if (ModelState.IsValid) { restaurantmodel.Menu = m_serviceLayer.GetRestaurantById(restaurantmodel.Id).Menu; //save existed menu m_serviceLayer.UpdateRestaurant(restaurantmodel); return RedirectToAction("Index"); } return View(restaurantmodel); }
public ActionResult Create(RestaurantModel restaurantmodel) { log.InfoFormat("[RestaurantsController.Create] RestaurantModel={0}", restaurantmodel.ToString()); ModelState.Remove("Adress.BuildingNum"); if (ModelState.IsValid) { string restId = m_serviceLayer.AddRestaurantToDB(restaurantmodel); return RedirectToAction("Details", new { id = restId }); } return View(restaurantmodel); }