public ActionResult Create([Bind(Exclude = "id")] Sale data) { if (!ModelState.IsValid) { return(View()); } obj.Sales.Add(data); obj.SaveChanges(); return(RedirectToAction("Create")); }
public ActionResult Create([Bind(Exclude = "id")] Register IdData) { if (!ModelState.IsValid) { return(View()); } obj.Registers.Add(IdData); obj.SaveChanges(); return(RedirectToAction("Confirmation")); }
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")); }
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)); }
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)); }
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)); }
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")); }
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)); }
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)); }
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)); }
// 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")); }
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(); } }
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(); } }