Exemple #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());
        }
 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());
     }
 }
 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());
     }
 }
        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());
            }
        }