示例#1
0
 public IActionResult UpDateDetail(DeliveryPlace model)
 {
     using (var db = new LogictisContext())
     {
         int id = 0;
         var g  = db.DeliveryPlace.SingleOrDefault(x => x.ID.Equals(model.ID));
         if (g is null)
         {
             var n = new DeliveryPlace();
             n.Name       = model.Name;
             n.Phone      = model.Phone;
             n.Adress     = model.Adress;
             n.CreateDate = DateTime.Now;
             db.DeliveryPlace.Add(n);
         }
         else
         {
             id       = model.ID;
             g.Name   = model.Name;
             g.Phone  = model.Phone;
             g.Adress = model.Adress;
         }
         db.SaveChanges();
     }
     return(RedirectToAction("Main"));
 }
示例#2
0
 public IActionResult DeteleDetail(int id)
 {
     using (var db = new LogictisContext())
     {
         var c = db.DeliveryPlace.Where(g => g.ID.Equals(id)).SingleOrDefault();
         db.DeliveryPlace.Remove(c);
         db.SaveChanges();
         var lstContainer = (from g in db.DeliveryPlace select g).ToList();
         return(View("Main", lstContainer));
     }
 }