コード例 #1
0
        public void TestSearchByString()
        {
            //Arrange
            Restaurant.Web.Models.Restaurant restaurant = new Restaurant.Web.Models.Restaurant();
            //Act
            var result = restaurant.GetRestaurantByName("t");
            var data   = result as IEnumerable <Restaurant.Web.Models.Restaurant>;

            //Assert
            Assert.AreEqual(2, data.Count());
        }
コード例 #2
0
 public ActionResult Create(Restaurant.Web.Models.Restaurant restaurant)
 {
     try
     {
         // TODO: Add insert logic here
         restaurant.AddRestaurant(restaurant);
         return(RedirectToAction("DisplayAll"));
     }
     catch (Exception e)
     {
         logger.Debug(e);
         return(View());
     }
 }
コード例 #3
0
 public ActionResult Edit(Restaurant.Web.Models.Restaurant restaurant)
 {
     try
     {
         // TODO: Add update logic here
         restaurant.UpdateRestaurant(restaurant);
         return(RedirectToAction("DisplayAll"));
     }
     catch (Exception e)
     {
         logger.Debug(e);
         return(View());
     }
 }
コード例 #4
0
        public ActionResult Delete(Restaurant.Web.Models.Restaurant restaurant)
        {
            try
            {
                // TODO: Add delete logic here
                restaurant.DeleteRestaurant(restaurant);

                return(View("Index"));
            }
            catch (Exception e)
            {
                logger.Debug(e);
                return(View());
            }
        }