// GET: Shippers/Delete/5 public ActionResult Delete(int id) { ShippersNegocio shippersNegocio = new ShippersNegocio(); Shippers shipper = shippersNegocio.GetOne(id); return(View(shipper)); }
// GET: Shippers public ActionResult Index() { ShippersNegocio shippersNegocio = new ShippersNegocio(); List <Shippers> shippers = shippersNegocio.GetShippers(); return(View(shippers)); }
static void Main(string[] args) { ShippersNegocio shippersNegocio = new ShippersNegocio(); List<Shippers> shippers = shippersNegocio.GetShippers(); foreach (Shippers shipper in shippers) { Console.WriteLine(shipper.CompanyName); } Console.ReadKey(); }
public ActionResult Delete(int id, FormCollection collection) { try { ShippersNegocio shippersNegocio = new ShippersNegocio(); shippersNegocio.DeleteShipper(id); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(int id, FormCollection collection) { try { ShippersNegocio shippersNegocio = new ShippersNegocio(); Shippers shipper = shippersNegocio.GetOne(id); shipper.CompanyName = collection["CompanyName"]; shipper.Phone = collection["Phone"]; shippersNegocio.EditarShipper(shipper); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Create(FormCollection collection) { try { Shippers shipper = new Shippers(); shipper.CompanyName = collection["CompanyName"]; shipper.Phone = collection["Phone"]; ShippersNegocio shippersNegocio = new ShippersNegocio(); shippersNegocio.AddShipper(shipper); return(RedirectToAction("Index")); } catch { return(View()); } }