public ActionResult Create(FormCollection collection) { try { var canteenRepo = new CanteenRepo(); Canteen canteen = new Canteen { CanteenName = collection["CanteenName"], Location = collection["Location"], Phone = collection["Phone"] }; if (canteenRepo.Add(canteen)) { return(RedirectToAction("Index")); } return(View()); } catch { return(View()); } }
// GET: Canteen public ActionResult Index() { var canteenRepo = new CanteenRepo(); return(View(canteenRepo.Listele())); }