예제 #1
0
        public ActionResult OrderPizza(IFormCollection collection, PizzaWebApp.Models.Orderpizza op)
        {
            Domain.Orderpizza dmc = new Domain.Orderpizza();

            dmc.orderid        = op.orderid;
            dmc.locationfid_op = Int32.Parse(TempData["id"].ToString());
            dmc.userFID        = Int32.Parse(TempData["userid"].ToString());
            dmc.Timecheck      = op.Timecheckdefault;
            //dmc.Timecheckdefault = op.Timecheckdefault;
            TempData.Keep("userId");
            TempData.Keep("id");
            try
            {
                if (TempData["userid"] != null)
                {
                    // if (((DateTime)op.Timecheckdefault - (DateTime)op.Timecheck).Hours < 24)
                    //{
                    db2.AddOrder(dmc);
                    db2.Save();
                    TempData.Keep("userId");
                    return(RedirectToAction("Index"));

                    //}
                    // else
                    // {
                    //TempData.Keep();
                    //return View();

                    // }
                }
                else
                {
                    TempData.Keep();
                    return(View());
                }
            }
            catch
            {
                return(View());
            }
        }
예제 #2
0
 public void RemoveOrder(Domain.Orderpizza order)
 {
     _db.Orderpizza.Remove(Mapper.Map(order));
 }
예제 #3
0
 public void UpdateOrder(Domain.Orderpizza order)
 {
     _db.Orderpizza.Update(Mapper.Map(order));
 }
예제 #4
0
 public void AddOrder(Domain.Orderpizza order)
 {
     _db.Orderpizza.Add(Mapper.Map(order));
 }