Ejemplo n.º 1
0
 public ActionResult AddShipper(Shipper model)
 {
     if (ModelState.IsValid)
     {
         repository.SaveShipper(model);
         return RedirectToAction("Home", new { app_culture = Request.RequestContext.RouteData.Values["app_culture"] });
     }
     return View("EditShipper", model);
 }
Ejemplo n.º 2
0
 public void SaveShipper(Shipper shipper)
 {
     if (shipper.ShipperID == 0)
         context.Shippers.Add(shipper);
     else
     {
         Shipper shipper_ = context.Shippers.Single(s => s.ShipperID == shipper.ShipperID);
         context.Entry(shipper_).CurrentValues.SetValues(shipper);
     }
     context.SaveChanges();
     Logger.Info(string.Format("Suhipper with id {0} and CompanyName {1} saved in database", shipper.ShipperID, shipper.CompanyName));
 }
Ejemplo n.º 3
0
 public void DeleteShipper(Shipper shipper)
 {
     context.Shippers.Remove(shipper);
     context.SaveChanges();
     Logger.Info(string.Format("Shipper with id {0} and CompanyName {1} removed from database", shipper.ShipperID, shipper.CompanyName));
 }