public async Task <ActionResult> Create([Bind(Include = "id,name,metatitle,status")] Category category)
        {
            if (ModelState.IsValid)
            {
                db.Categories.Add(category);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
Esempio n. 2
0
        public async Task <ActionResult> Create([Bind(Include = "id,name")] MenuType menuType)
        {
            if (ModelState.IsValid)
            {
                db.MenuTypes.Add(menuType);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(menuType));
        }
        public async Task <ActionResult> Create([Bind(Include = "id,name,sale,status")] Discount discount)
        {
            if (ModelState.IsValid)
            {
                db.Discounts.Add(discount);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(discount));
        }
Esempio n. 5
0
        public async Task <ActionResult> Create([Bind(Include = "id,name,metatitle,author,idCategory,price,status,image")] Book book)
        {
            if (ModelState.IsValid)
            {
                db.Books.Add(book);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.idCategory = new SelectList(db.Categories, "id", "name", book.idCategory);
            return(View(book));
        }
Esempio n. 6
0
        public async Task <ActionResult> Create([Bind(Include = "id,name,link,displayorder,status,typeid")] Menu menu)
        {
            if (ModelState.IsValid)
            {
                db.Menus.Add(menu);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.typeid = new SelectList(db.MenuTypes, "id", "name", menu.typeid);
            return(View(menu));
        }
Esempio n. 7
0
        public async Task <ActionResult> Create([Bind(Include = "id,idBill,quantity,price")] BillDetail billDetail)
        {
            if (ModelState.IsValid)
            {
                db.BillDetails.Add(billDetail);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.idBill = new SelectList(db.Bills, "id", "shipaddress", billDetail.idBill);
            return(View(billDetail));
        }
Esempio n. 8
0
        public async Task <ActionResult> Create([Bind(Include = "id,idCustomer,idDiscount,sale,checkin,shipaddress,shipMobile,shipname,shipemail")] Bill bill)
        {
            if (ModelState.IsValid)
            {
                db.Bills.Add(bill);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            ViewBag.idCustomer = new SelectList(db.Accounts, "id", "username", bill.idCustomer);
            ViewBag.idDiscount = new SelectList(db.Discounts, "id", "id", bill.idDiscount);
            return(View(bill));
        }
Esempio n. 9
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            Account account = await db.Accounts.FindAsync(id);

            db.Accounts.Remove(account);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }