public async Task <ActionResult> DeleteConfirmed(int id) { BasketMaster basketMaster = await db.BasketMasters.FindAsync(id); db.BasketMasters.Remove(basketMaster); await db.SaveChangesAsync(); return(RedirectToAction("Index")); }
public async Task <ActionResult> Edit([Bind(Include = "BasketID,BasketName,SKUID")] BasketMaster basketMaster) { if (ModelState.IsValid) { db.Entry(basketMaster).State = EntityState.Modified; await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(basketMaster)); }
public async Task <ActionResult> Create([Bind(Include = "BasketID,BasketName,SKUID")] BasketMaster basketMaster) { if (ModelState.IsValid) { db.BasketMasters.Add(basketMaster); await db.SaveChangesAsync(); return(RedirectToAction("Index")); } return(View(basketMaster)); }
// GET: BasketMasters/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BasketMaster basketMaster = await db.BasketMasters.FindAsync(id); if (basketMaster == null) { return(HttpNotFound()); } return(View(basketMaster)); }
public JsonResult PlaceBasketOrder(int basketId) { int result = 0; string pcIp = GetIp(); BasketMaster _basketMaster = new BasketMaster(); _basketMaster = _context.BasketMasters.Where(bi => bi.BasketID == basketId).FirstOrDefault(); OrderBasket oBasket = new OrderBasket(); oBasket.BasketID = _basketMaster.BasketID; oBasket.BasketName = _basketMaster.BasketName; oBasket.SKUID = _basketMaster.SKUID; oBasket.OrderDate = DateTime.Now; oBasket.OrderBy = pcIp; _context.OrderBaskets.Add(oBasket); result = _context.SaveChanges(); return(Json(result, JsonRequestBehavior.AllowGet)); }