// GET: Customer/Index public ActionResult Index() { using (DbMagnifierModel dbMagnifierModel = new DbMagnifierModel()) { return(View(dbMagnifierModel.Customers.ToList())); } }
public ActionResult Create(Customer customer) { try { using (DbMagnifierModel dbMagnifierModel = new DbMagnifierModel()) { dbMagnifierModel.Customers.Add(customer); dbMagnifierModel.SaveChanges(); } // TODO: Add insert logic here return(RedirectToAction("Index")); } catch { return(View()); } }