示例#1
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            using (DAL.BarContext db = new DAL.BarContext())
            {
                Order order = await db.Orders.FindAsync(id);

                db.Orders.Remove(order);
                await db.SaveChangesAsync();

                return(RedirectToAction("YourOrder"));
            }
        }
示例#2
0
        public async Task <ActionResult> Delete(int?id)
        {
            using (DAL.BarContext db = new DAL.BarContext()) {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                Order order = await db.Orders.FindAsync(id);

                if (order == null)
                {
                    return(HttpNotFound());
                }
                return(View(order));
            }
        }