Exemple #1
0
        internal void AddQuantityToProduct(string name, int count)
        {
            var querry = restaurant.Products
                         .Where(x => x.Name.Contains(name)).FirstOrDefault();

            querry.Total_Quantity += count;

            restaurant.SaveChanges();
        }
      public ActionResult Create([Bind(Include = "Menu_Id,Meal_Name,Meal_Type,Calories,Price")] Menu menu)
      {
          if (ModelState.IsValid)
          {
              db.Menus.Add(menu);
              db.SaveChanges();
              return(RedirectToAction("Index"));
          }

          return(View(menu));
      }
        public ActionResult Create([Bind(Include = "Order_Id,Customer_Name,Address,Menu_Id,Quantity")] Order order)
        {
            if (ModelState.IsValid)
            {
                db.Orders.Add(order);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.Menu_Id = new SelectList(db.Menus.OrderBy(a => a.Meal_Name), "Menu_Id", "Meal_Name");
            return(View(order));
        }
        public void RegisterUser(string firstName, string lastName, string email, string adress, string phone, string password)
        {
            restaurant.Users.Add(new User()
            {
                First_Name   = firstName,
                Last_Name    = lastName,
                Email        = email,
                Adress       = adress,
                Phone        = phone,
                Password     = password,
                Account_Type = 1
            });

            restaurant.SaveChanges();
        }