예제 #1
0
 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());
     }
 }
예제 #2
0
        // GET: Canteen
        public ActionResult Index()
        {
            var canteenRepo = new CanteenRepo();

            return(View(canteenRepo.Listele()));
        }