コード例 #1
0
        // GET: Resturant
        public ActionResult Index()
        {
            //sql queries to update the database with up-to-date averages for overall ratings
            foreach (Restaurant item in db.restaurants.ToList())
            {
                if (db.Database.SqlQuery <Review>("Select * from Review Where RestCode = @iCode", new SqlParameter("@iCode", item.RestCode)).FirstOrDefault() != null)
                {
                    //overall rating
                    item.RestOverallRating = db.Database.SqlQuery <decimal>("Select Cast(Avg(ReviewOverallRating) AS Decimal(4,2)) From Review Where RestCode = @iCode", new SqlParameter("@iCode", item.RestCode)).FirstOrDefault();
                    //cleanliness rating
                    item.RestCleanliness = db.Database.SqlQuery <decimal>("Select Cast(Avg(ReviewCleanliness) AS Decimal(4,2)) From Review Where RestCode = @iCode", new SqlParameter("@iCode", item.RestCode)).FirstOrDefault();

                    //Date friendly
                    int    sum   = db.Database.SqlQuery <int>("Select Count(ReviewDateFriendly) From Review Where RestCode =  @iCode AND ReviewDateFriendly = 1", new SqlParameter("@iCode", item.RestCode)).FirstOrDefault();
                    int    count = db.Database.SqlQuery <int>("Select Count(ReviewDateFriendly) From Review Where RestCode =  @iCode", new SqlParameter("@iCode", item.RestCode)).FirstOrDefault();
                    double avg   = (double)sum / count;

                    if (avg > 0.5)
                    {
                        item.RestDateFriendly = true;
                    }
                    else
                    {
                        item.RestDateFriendly = false;
                    }

                    db.Entry(item).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }

            return(View(db.restaurants.ToList()));
        }
コード例 #2
0
        public async Task <ActionResult <Order> > PostOrder(Order order)
        {
            if (order.OrderId == 0)
            {
                _context.Order.Add(order);
            }
            else
            {
                _context.Entry(order).State = EntityState.Modified;
            }

            // delete existing order details
            foreach (var orderDetail in order.OrderDetails)
            {
                if (order.DeletedOrderDetailsId != null && order.DeletedOrderDetailsId.Contains(orderDetail.OrderDetailId))
                {
                    _context.Entry(orderDetail).State = EntityState.Deleted;
                }
                else
                {
                    if (orderDetail.OrderDetailId > 0)
                    {
                        _context.Entry(orderDetail).State = EntityState.Modified;
                    }
                    else
                    {
                        _context.Entry(orderDetail).State = EntityState.Added;
                    }
                }
            }

            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetOrder", new { id = order.OrderId }, null));
        }
コード例 #3
0
ファイル: OrderRepository.cs プロジェクト: jah118/3semG3
        public OrderDTO Create(OrderDTO obj, bool transactionEndpoint = true)
        {
            //Sanity check here, ensure unique tables etc
            if (transactionEndpoint)
            {
                _context.Database.BeginTransaction(IsolationLevel.Serializable);
            }
            try
            {
                if (RestaurantOrder.Validate(obj))
                {
                    RestaurantOrder order       = null;
                    var             notNewOrder = _context.RestaurantOrder.FirstOrDefault(o => o.ReservationId == obj.ReservationID);
                    if (notNewOrder != null)
                    {
                        var orderDto = Update(obj, false);
                        order = Converter.Convert(orderDto);
                    }
                    else
                    {
                        order             = Converter.Convert(obj);
                        order.OrderDate   = DateTime.Now;
                        order.Employee    = _context.Employee.FirstOrDefault(e => e.Id.Equals(obj.EmployeeID));
                        order.Reservation = _context.Reservation.FirstOrDefault(r => r.Id.Equals(obj.ReservationID));
                        var tempPaymentCondition = _context.PaymentCondition.FirstOrDefault(x => x.Condition.Equals(obj.PaymentCondition)).Id;
                        if (tempPaymentCondition > 0)
                        {
                            order.PaymentConditionId = tempPaymentCondition;
                            order.PaymentCondition   =
                                _context.PaymentCondition.FirstOrDefault(pc => pc.Id.Equals(order.PaymentConditionId));
                        }

                        var added = _context.RestaurantOrder.Add(order);
                        _context.SaveChanges();
                    }


                    if (transactionEndpoint)
                    {
                        _context.Database.CommitTransaction();
                    }
                    _context.Entry(order).GetDatabaseValues();
                    return(GetById(order.OrderNo));
                }
            }
            catch (Exception)
            {
                _context.Database.RollbackTransaction();
                throw;
            }

            return(null);
        }
コード例 #4
0
        /*  public static List<Review> lstReviews = new List<Review>()
         * {
         *    new Review { ReviewCode = 1, RestCode = 1, ReviewOverallRating = 3, ReviewDateFriendly = true, ReviewCleanliness = 4, ReviewDate = "10/18/18", ReviewDesc = "We had a party of Five hungry adults and one hungry toddler. Three picky eaters too. We happened upon this place. We had intentions of going somewhere else. Decided to try this place and we were beyond thrilled we went. Top notch customer service. They catered to all the picky eaters. It was delicious and such friendly customer service. Loved it!  It's a new favorite."},
         *    new Review { ReviewCode = 2, RestCode = 2, ReviewOverallRating = 2, ReviewDateFriendly = true, ReviewCleanliness = 4, ReviewDate = "10/18/18", ReviewDesc = "This is an awesome restaurant"},
         *    new Review { ReviewCode = 3, RestCode = 3, ReviewOverallRating = 5, ReviewDateFriendly = true, ReviewCleanliness = 4, ReviewDate = "10/18/18", ReviewDesc = "This is an awesome restaurant"},
         *    new Review { ReviewCode = 4, RestCode = 1, ReviewOverallRating = 4, ReviewDateFriendly = false, ReviewCleanliness = 4, ReviewDate = "10/18/18", ReviewDesc = "This is an awesome restaurant"},
         *    new Review { ReviewCode = 5, RestCode = 2, ReviewOverallRating = 3, ReviewDateFriendly = true, ReviewCleanliness = 4, ReviewDate = "10/18/18", ReviewDesc = "This is an awesome restaurant"},
         *    new Review { ReviewCode = 6, RestCode = 3, ReviewOverallRating = 4, ReviewDateFriendly = false, ReviewCleanliness = 4, ReviewDate = "10/18/18", ReviewDesc = "This is an awesome restaurant"},
         *    new Review { ReviewCode = 7, RestCode = 1, ReviewOverallRating = 2, ReviewDateFriendly = true, ReviewCleanliness = 4, ReviewDate = "10/18/18", ReviewDesc = "This is an awesome restaurant"},
         *    new Review { ReviewCode = 8, RestCode = 2, ReviewOverallRating = 1, ReviewDateFriendly = false, ReviewCleanliness = 4, ReviewDate = "10/18/18", ReviewDesc = "This is an awesome restaurant"},
         *    new Review { ReviewCode = 9, RestCode = 3, ReviewOverallRating = 4, ReviewDateFriendly = true, ReviewCleanliness = 4, ReviewDate = "10/18/18", ReviewDesc = "This is an awesome restaurant"},
         * };*/


        // GET: Reviews
        public ActionResult ShowReviews(int iCode)
        {
            //find the restaurant object that they clicked on
            Restaurant oRestaurant = db.restaurants.ToList().Find(x => x.RestCode == iCode);

            //finds the current average overall if there are any reviews
            if (db.Database.SqlQuery <Review>("Select * from Review Where RestCode = @iCode", new SqlParameter("@iCode", iCode)).FirstOrDefault() != null)
            {
                //overall
                decimal overall = db.Database.SqlQuery <decimal>("Select Cast(Avg(ReviewOverallRating) AS Decimal(4,2)) From Review Where RestCode = @iCode", new SqlParameter("@iCode", iCode)).FirstOrDefault();
                oRestaurant.RestOverallRating = overall;
                //cleanliness
                decimal cleanliness = db.Database.SqlQuery <decimal>("Select Cast(Avg(ReviewCleanliness) AS Decimal(4,2)) From Review Where RestCode = @iCode", new SqlParameter("@iCode", iCode)).FirstOrDefault();
                oRestaurant.RestCleanliness = cleanliness;

                //Date friendly
                int    sum   = db.Database.SqlQuery <int>("Select Count(ReviewDateFriendly) From Review Where RestCode =  @iCode AND ReviewDateFriendly = 1", new SqlParameter("@iCode", iCode)).FirstOrDefault();
                int    count = db.Database.SqlQuery <int>("Select Count(ReviewDateFriendly) From Review Where RestCode =  @iCode", new SqlParameter("@iCode", iCode)).FirstOrDefault();
                double avg   = (double)sum / count;

                if (avg > 0.5)
                {
                    oRestaurant.RestDateFriendly = true;
                }
                else
                {
                    oRestaurant.RestDateFriendly = false;
                }
                db.Entry(oRestaurant).State = EntityState.Modified;
                db.SaveChanges();
            }

            //list of all the reviews
            List <Review> lstReviews = db.reviews.ToList();

            //empty list that will contain all reviews for specific restaurants
            List <Review> specReviews = new List <Review>();

            for (var iCount = 0; iCount < lstReviews.Count; iCount++)
            {
                //if the review has same restaurant code as the restaurant clicked on, add that review to specific list
                if (lstReviews[iCount].RestCode == oRestaurant.RestCode)
                {
                    specReviews.Add(lstReviews[iCount]);
                }
            }

            //pass to models to view with tuple.  the restaurant object for summary info, and specific reviews for that restaurant
            var model = Tuple.Create <Restaurant, IEnumerable <Review> >(oRestaurant, specReviews);

            return(View(model));
        }
コード例 #5
0
        public async Task <IActionResult> PutPhieuNhapKho(int id, PhieuNhapKho phieuNhapKho)
        {
            if (id != phieuNhapKho.Id)
            {
                return(BadRequest());
            }

            _context.Entry(phieuNhapKho).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PhieuNhapKhoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #6
0
        public IHttpActionResult PutMealIngredient(int id, MealIngredient mealIngredient)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != mealIngredient.Id_MealIngredient)
            {
                return(BadRequest());
            }

            db.Entry(mealIngredient).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MealIngredientExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #7
0
        public async Task <IActionResult> PutEmployee(int id, Employee employee)
        {
            if (id != employee.Id)
            {
                return(BadRequest());
            }

            _context.Entry(employee).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!EmployeeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #8
0
        public async Task <IActionResult> PutKhachHang(int id, KhachHang khachHang)
        {
            if (id != khachHang.Id)
            {
                return(BadRequest());
            }

            _context.Entry(khachHang).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!KhachHangExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #9
0
        public JsonResult Put(int id, [FromBody] Product value)
        {
            try
            {
                using (var db = new RestaurantContext())
                {
                    Product product = db.Product.First(P => P.Id == id);

                    value.Id = product.Id;

                    db.Entry(product).CurrentValues.SetValues(value);

                    db.SaveChanges();

                    return(Json(new Response {
                        Error = false, Description = "success"
                    }));
                }
            }
            catch (Exception e)
            {
                return(Json(new Response {
                    Error = true, Description = "error_occurred", Result = e
                }));
            }
        }
コード例 #10
0
        public void Update(TEntity t)
        {
            var entry = Context.Entry(t);

            DbSet.Attach(t);
            entry.State = EntityState.Modified;
        }
コード例 #11
0
        public async Task <IActionResult> PutCity(long id, City city)
        {
            if (id != city.Id)
            {
                return(BadRequest());
            }

            _context.Entry(city).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CityExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #12
0
        public JsonResult Put(int id, [FromBody] Restaurant value)
        {
            try
            {
                using (var db = new RestaurantContext())
                {
                    Restaurant config = db.Restaurant.First();

                    value.Id = config.Id;

                    db.Entry(config).CurrentValues.SetValues(value);

                    if (!string.IsNullOrEmpty(value.Logo))
                    {
                        Utils.SaveFileFromBase64(value.LogoBase64, value.Logo, "logo");
                    }

                    return(Json(new Response {
                        Error = false, Description = "success"
                    }));
                }
            }
            catch (Exception e)
            {
                return(Json(new Response {
                    Error = true, Description = "error_occurred", Result = e
                }));
            }
        }
コード例 #13
0
        public JsonResult Put(int id, [FromBody] Client value)
        {
            try
            {
                using (var db = new RestaurantContext())
                {
                    Client client = db.Client.SingleOrDefault(O => O.Id == id);

                    value.Id = client.Id;

                    db.Entry(client).CurrentValues.SetValues(value);

                    db.SaveChanges();

                    return(Json(new Response {
                        Error = false, Description = "success"
                    }));
                }
            }
            catch (Exception e)
            {
                return(Json(new Response {
                    Error = true, Description = "error_occurred", Result = e
                }));
            }
        }
コード例 #14
0
        public async Task <ActionResult <BaseRespone> > PostMonAn([FromForm] MonAn monAn)
        {
            try
            {
                var file = monAn.File;
                _context.MonAns.Add(monAn);
                await _context.SaveChangesAsync();

                if (file != null)
                {
                    string newFileName = monAn.Id + "_" + file.FileName;
                    string path        = _hostingEnviroment.WebRootPath + "\\Data\\sanpham\\" + newFileName;
                    using (var stream = new FileStream(path, FileMode.Create))
                    {
                        file.CopyTo(stream);
                        monAn.hinh = newFileName;
                        _context.Entry(monAn).Property(x => x.hinh).IsModified = true;
                        _context.SaveChanges();
                    }
                }
                return(new BaseRespone(CreatedAtAction("Get", new { id = monAn.Id }, monAn)));
            }
            catch
            {
                return(new BaseRespone {
                    ErrorCode = 1, Message = "Lỗi"
                });
            }
        }
コード例 #15
0
        public IHttpActionResult PutFavorite(int id, Favorite favorite)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != favorite.Id)
            {
                return(BadRequest());
            }

            db.Entry(favorite).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FavoriteExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #16
0
        public async Task <IActionResult> PutMenu(int id, Menu menu)
        {
            if (id != menu.MenuId)
            {
                return(BadRequest());
            }

            _context.Entry(menu).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MenuExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #17
0
        public async Task <IActionResult> PutRestaurants([FromRoute] int id, [FromBody] Restaurants restaurants)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != restaurants.Id)
            {
                return(BadRequest());
            }

            _context.Entry(restaurants).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!RestaurantsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #18
0
        public async Task <IActionResult> PutThanhPhanMonAn(int id, ThanhPhanMonAn thanhPhanMonAn)
        {
            if (id != thanhPhanMonAn.Id)
            {
                return(BadRequest());
            }

            _context.Entry(thanhPhanMonAn).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ThanhPhanMonAnExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #19
0
        /// <summary>
        /// Update a restaurant, ignoring any attached reviews.
        /// </summary>
        /// <param name="restaurant">The restaurant with changed values</param>
        public void UpdateRestaurant(Restaurant restaurant)
        {
            // one of several ways to do updates with EF Core.
            // in this case, we get the current values from the DB...
            Restaurant currentEntity = _context.Restaurants
                                       .First(r => r.Id == restaurant.Id);

            // and use these APIs on the context to copy the regular properties over.
            _context.Entry(currentEntity).CurrentValues.SetValues(restaurant);

            // it could also work to do _context.Restaurants.Update(restaurant).
            // this would cause the object to become tracked by the context,
            // and it would apply any changes found in the nested reviews too.

            _context.SaveChanges();
        }
コード例 #20
0
        public async Task <IActionResult> PutDish(int id, Dish dish)
        {
            if (id != dish.Id)
            {
                return(BadRequest());
            }

            _context.Entry(dish).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DishExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #21
0
        public async Task <IActionResult> PutOrder(int id, Order order)
        {
            if (id != order.OrderId)
            {
                return(BadRequest());
            }

            _context.Entry(order).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OrderExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #22
0
ファイル: LocationRestController.cs プロジェクト: St14S/git
        public async Task <IActionResult> PutLocationRestaurant(int id, LocationRestaurant locationRestaurant)
        {
            if (id != locationRestaurant.Id)
            {
                return(BadRequest());
            }

            _context.Entry(locationRestaurant).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!LocationRestaurantExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
コード例 #23
0
 public void UpdateSpecialEvent(SpecialEvent Entities)
 {
     using (RestaurantContext specialEventDBContext = new RestaurantContext())
     { var updating = specialEventDBContext.SpecialEvents.Attach(Entities);
       var matchingWithExistingValues = specialEventDBContext.Entry <SpecialEvent>(updating);
       matchingWithExistingValues.State = System.Data.Entity.EntityState.Modified;
       specialEventDBContext.SaveChanges(); }
 }
コード例 #24
0
        public async Task Remove <T>(T toRemove)
        {
            switch (toRemove.GetType().Name)
            {
            case "Restaurant":
                var typedUpdate = DynamicTyping.ConvertValue <Restaurant>(toRemove);
                var existing    = await context.Restaurants.FindAsync(typedUpdate.Id);

                existing.Archived = true;
                context.Restaurants.Attach(existing);
                context.Entry(existing).State = EntityState.Modified;
                break;

            default:
                throw new NotImplementedException();
            }
            await context.SaveChangesAsync();
        }
コード例 #25
0
 public ActionResult Edit([Bind(Include = "ProductId,ProductName,ProductDescription,ProductPrice")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(product));
 }
コード例 #26
0
 public ActionResult Edit([Bind(Include = "Id,Naam,VoedselType,Prijs,Btw_Tarief,Beschikbaar")] Voedsel voedsel)
 {
     if (ModelState.IsValid)
     {
         db.Entry(voedsel).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(voedsel));
 }
コード例 #27
0
 public ActionResult Edit([Bind(Include = "FoodId,Name,Description,Price,Type")] FoodItem foodItem)
 {
     if (ModelState.IsValid)
     {
         db.Entry(foodItem).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(foodItem));
 }
コード例 #28
0
 public ActionResult Edit([Bind(Include = "ID,DepartmentName")] Department department)
 {
     if (ModelState.IsValid)
     {
         db.Entry(department).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(department));
 }
コード例 #29
0
 public ActionResult Edit([Bind(Include = "ID,Price,Type,Name,Description")] Item item)
 {
     if (ModelState.IsValid)
     {
         restaurantDb.Entry(item).State = EntityState.Modified;
         restaurantDb.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(item));
 }
コード例 #30
0
 public ActionResult Edit([Bind(Include = "CustomerId,FirstName,LastName")] Customer customer)
 {
     if (ModelState.IsValid)
     {
         db.Entry(customer).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(customer));
 }
コード例 #31
0
ファイル: AdminController.cs プロジェクト: swu18/InClassDemo
 public void SeatCustomer(DateTime when, int reservationId, List<byte> tables, int waiterId)
 {
     var availableSeats = AvailableSeatingByDateTime(when.Date, when.TimeOfDay);
     using (var context = new RestaurantContext())
     {
         List<string> errors = new List<string>();
         // Rule checking:
         // - Reservation must be in Booked status
         // - Table must be available - typically a direct check on the table, but proxied based on the mocked time here
         // - Table must be big enough for the # of customers
         var reservation = context.Reservations.Find(reservationId);
         if (reservation == null)
             errors.Add("The specified reservation does not exist");
         else if (reservation != null && reservation.ReservationStatus != Reservation.Booked)
             errors.Add("The reservation's status is not valid for seating. Only booked reservations can be seated.");
         var capacity = 0;
         foreach (var tableNumber in tables)
         {
             if (!availableSeats.Exists(x => x.Table == tableNumber))
                 errors.Add("Table " + tableNumber + " is currently not available");
             else
                 capacity += availableSeats.Single(x => x.Table == tableNumber).Seating;
         }
         if (capacity < reservation.NumberInParty)
             errors.Add("Insufficient seating capacity for number of customers. Alternate tables must be used.");
         if (errors.Count > 0)
             throw new BusinessRuleException("Unable to seat customer", errors);
         // 1) Create a blank bill with assigned waiter
         Bill seatedCustomer = new Bill()
         {
             BillDate = when,
             NumberInParty = reservation.NumberInParty,
             WaiterID = waiterId,
             ReservationID = reservation.ReservationID
         };
         context.Bills.Add(seatedCustomer);
         // 2) Add the tables for the reservation and change the reservation's status to arrived
         foreach (var tableNumber in tables)
             reservation.Tables.Add(context.Tables.Single(x => x.TableNumber == tableNumber));
         reservation.ReservationStatus = Reservation.Arrived;
         var updatable = context.Entry(context.Reservations.Attach(reservation));
         updatable.Property(x => x.ReservationStatus).IsModified = true;
         //updatable.Reference(x=>x.Tables).
         // 3) Save changes
         context.SaveChanges();
     }
     //string message = String.Format("Not yet implemented. Need to seat reservation {0} for waiter {1} at tables {2}", reservationId, waiterId, string.Join(", ", tables));
     //throw new NotImplementedException(message);
 }