public async Task <IHttpActionResult> PutMenuCategory(int id, MenuCategory menuCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != menuCategory.MenuCategoryId)
            {
                return(BadRequest());
            }

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

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

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <ActionResult> Edit([Bind(Include = "MenuCategoryId,CategoryName,ImagePath")] MenuCategory menucategory)
        {
            if (ModelState.IsValid)
            {
                db.Entry(menucategory).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(menucategory));
        }
        public async Task <ActionResult> Edit([Bind(Include = "CustomerId,FirstName,LastName,Address,Phone")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Entry(customer).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(customer));
        }
Esempio n. 4
0
        public async Task <ActionResult> Edit([Bind(Include = "OrderId,Name,DateOrdered,DateReceived,AmountPaid,CustomerId")] Order order)
        {
            if (ModelState.IsValid)
            {
                db.Entry(order).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.CustomerId = new SelectList(db.Customers, "CustomerId", "FirstName", order.CustomerId);
            return(View(order));
        }
Esempio n. 5
0
        public async Task <ActionResult> Edit([Bind(Include = "MenuItemId,Name,Description,Price,ImagePath,MenuCategoryId")] MenuItem menuitem)
        {
            if (ModelState.IsValid)
            {
                db.Entry(menuitem).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.MenuCategoryId = new SelectList(db.MenuCategories, "MenuCategoryId", "CategoryName", menuitem.MenuCategoryId);
            return(View(menuitem));
        }
        public async Task <ActionResult> Edit([Bind(Include = "OrderedItemId,MenuItemId,OrderId,Quantity")] OrderedItem ordereditem)
        {
            if (ModelState.IsValid)
            {
                db.Entry(ordereditem).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewBag.MenuItemId = new SelectList(db.MenuItems, "MenuItemId", "Name", ordereditem.MenuItemId);
            ViewBag.OrderId    = new SelectList(db.Orders, "OrderId", "Name", ordereditem.OrderId);
            return(View(ordereditem));
        }