Пример #1
0
 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));
 }
Пример #2
0
        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));
        }
Пример #3
0
        // GET: RestaurantBranches/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RestaurantBranchViewModel restaurantBranch = RepositoryHandler.RestaurantBranchRepository.GetAsViewModel(id ?? 0);

            restaurantBranch.SetLocation();
            if (restaurantBranch == null)
            {
                return(HttpNotFound());
            }
            ViewBag.Restaurants = Restaurants;
            return(View(restaurantBranch));
        }