コード例 #1
0
 public ActionResult Create([Bind(Exclude = "id")] Sale data)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     obj.Sales.Add(data);
     obj.SaveChanges();
     return(RedirectToAction("Create"));
 }
コード例 #2
0
 public ActionResult Create([Bind(Exclude = "id")] Register IdData)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     obj.Registers.Add(IdData);
     obj.SaveChanges();
     return(RedirectToAction("Confirmation"));
 }
コード例 #3
0
 public ActionResult Create([Bind(Exclude = "id")] staff IdData)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     obj.staffs.Add(IdData);
     obj.SaveChanges();
     //Response.Redirect("StudentAdmission",true);
     return(RedirectToAction("StaffDetails"));
 }
コード例 #4
0
        public ActionResult Create([Bind(Include = "StoreId,StoreName,StoreAddress,StoreCity,StoreState,StoreZipCode,IsSelected")] Store store)
        {
            if (ModelState.IsValid)
            {
                db.Stores.Add(store);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(store));
        }
コード例 #5
0
        public ActionResult Create([Bind(Include = "CustomerId,CFirstName,CLastName,CAddress,CCity,CState,CZipCode")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
コード例 #6
0
        public ActionResult Create([Bind(Include = "CategoryId,CategoryName,Desription")] Category category)
        {
            if (ModelState.IsValid)
            {
                db.Categories.Add(category);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(category));
        }
コード例 #7
0
 public ActionResult Create([Bind(Exclude = "id")] Purchase data)
 {
     if (!ModelState.IsValid)
     {
         return(View());
     }
     obj.Purchases.Add(data);
     obj.SaveChanges();
     //Response.Redirect("StudentAdmission",true);
     return(RedirectToAction("PurchaseList"));
 }
コード例 #8
0
        public ActionResult Create([Bind(Include = "ListId,CustomerId,ListDate")] List list)
        {
            if (ModelState.IsValid)
            {
                db.Lists.Add(list);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CustomerId = new SelectList(db.Customers, "CustomerId", "CFirstName", list.CustomerId);
            return(View(list));
        }
コード例 #9
0
        public ActionResult Create([Bind(Include = "ProductId,ProductName,CategoryId,IsSelected,Price,Quantity")] Product product)
        {
            if (ModelState.IsValid)
            {
                db.Products.Add(product);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "CategoryName", product.CategoryId);
            return(View(product));
        }
コード例 #10
0
        public ActionResult Create([Bind(Include = "ListId,ProductId,StoreId,ListDetailsId,StoreNameTwo")] ListDetail listDetail)
        {
            if (ModelState.IsValid)
            {
                db.ListDetails.Add(listDetail);
                db.SaveChanges();
                return(RedirectToAction("Create"));
            }

            ViewBag.ListId    = new SelectList(db.Lists, "ListId", "ListId", listDetail.ListId);
            ViewBag.ProductId = new SelectList(db.Products, "ProductId", "ProductName", listDetail.ProductId);
            ViewBag.StoreId   = new SelectList(db.Stores, "StoreId", "StoreName", listDetail.StoreId);
            return(View(listDetail));
        }
コード例 #11
0
        // GET: Query/Delete/5
        public ActionResult Delete(FeedBack Id)
        {
            var d = obj.FeedBacks.Where(x => x.id == Id.id).FirstOrDefault();

            obj.FeedBacks.Remove(d);
            obj.SaveChanges();
            return(RedirectToAction("QueryDetails"));
        }
コード例 #12
0
ファイル: GroceryDataMapper.cs プロジェクト: tmukka/Grocery
 public static void UpdateInventoryDetails(List <Items> itemList)
 {
     using (var context = new GroceryEntities())
     {
         foreach (Items item in itemList)
         {
             var discountOnItem = context.Inventories.FirstOrDefault(i => i.item_id == item.ItemId);
             discountOnItem.Quantity = discountOnItem.Quantity - item.ItemCount;
         }
         context.SaveChanges();
     }
 }
コード例 #13
0
ファイル: GroceryDataMapper.cs プロジェクト: tmukka/Grocery
 public static void RecordOrderTransactions(decimal amount, string eid)
 {
     using (var context = new GroceryEntities())
     {
         var maxID = context.ORDERS.Any() ? context.ORDERS.OrderByDescending(x => x.ORD_NUM).First().ORD_NUM : 0;
         var order = context.ORDERS.Add(context.ORDERS.Create());
         maxID             = maxID + 1;
         order.ORD_NUM     = maxID;
         order.Employee_id = eid;
         order.ORD_DATE    = DateTime.Now;
         order.ORD_AMOUNT  = amount;
         context.SaveChanges();
     }
 }