public ActionResult Edit([Bind(Include = "Id,Name,IdRestaurant,IdLocation,Phone,Latitude,Longitude")] RestaurantBranchViewModel restaurantBranch) { if (ModelState.IsValid) { db.Entry(restaurantBranch.GetRestaurantBranch()).State = EntityState.Modified; db.Entry(restaurantBranch.GetRestaurantBranch().Location).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(restaurantBranch)); }
public ActionResult Create([Bind(Include = "Id,Name,IdRestaurant,IdLocation,Phone,Latitude,Longitude")] RestaurantBranchViewModel restaurantBranch) { if (ModelState.IsValid) { db.RestaurantBranches.Add(restaurantBranch.GetRestaurantBranch()); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(restaurantBranch)); }