Example #1
0
        /// <summary>
        /// Edit menu is used for editing the menu, Menuview is passed to it as argument.
        /// </summary>
        /// <param name="menuView"></param>
        /// <returns></returns>

        public MenuViewModel EditMenu(MenuViewModel menuView)
        {
            Menu menu = Mapper.Map <MenuViewModel, Menu>(menuView);

            db.Entry(menu).State = EntityState.Modified;
            db.SaveChanges();
            return(menuView);
        }
Example #2
0
        public EditOrder(EditOrderViewModel edit)
        {
            List <Order> order = db.Orders.Where(m => m.TableNo == edit.EditTableId).ToList();
            Mappings     map   = new Mappings();

            //Delete Order
            if (edit.OrderDeletion == true)
            {
                ManageRestaurant manage = new ManageRestaurant();
                foreach (Order index in order)
                {
                    db.Orders.Remove(index);
                    db.SaveChanges();
                }
                manage.TableStatus((int)edit.EditTableId, false);
            }
            //Update Order
            else
            {
                for (int index = 0; index < edit.EditedQuantity.Count(); index++)
                {
                    order[index].Quantity        = edit.EditedQuantity[index];
                    db.Entry(order[index]).State = EntityState.Modified;
                    db.SaveChanges();
                }
            }
        }