public RestaurantType Delete(RestaurantType entity)
 {
     using (_connection = Utilities.GetProfiledOpenConnection())
     {
        _connection.Delete(entity);
     }
     return entity;
 }
 public RestaurantType SaveOrUpdate(RestaurantType entity)
 {
     using (_connection = Utilities.GetProfiledOpenConnection())
     {
         if (entity.Id > 0)
         {
             entity.Id = _connection.Update(entity);
         }
         else
         {
             var insert = _connection.Insert(entity);
                 entity.Id = (int)insert;
         }
         return entity;
     }
 }
 public ActionResult Create([Bind(Exclude = "Id")] ViewModels.Restaurant model)
 {
     if (ModelState.IsValid)
     {
         if (model.RestaurantTypeID == null && !string.IsNullOrWhiteSpace(model.NewRestaurantTypeName))
         {
             // Add new restaurant type
             var newType = new RestaurantType {TypeName = model.NewRestaurantTypeName.Trim()};
             newType = _restaurantTypeLogic.SaveOrUpdate(newType);
             if (newType != null)
                 model.RestaurantTypeID = newType.Id;
         }
         var xmodel = Mapper.Map<ViewModels.Restaurant, Restaurant>(model);
         _restaurantLogic.SaveOrUpdate(xmodel);
         return RedirectToAction("Index");
     }
     ViewBag.RestaurantTypeList = _restaurantTypeLogic.GetAll();
     return View("Edit", model);
 }
 public RestaurantType SaveOrUpdate(RestaurantType entity)
 {
     return _restaurantTypeRepository.SaveOrUpdate(entity);
 }
 public RestaurantType Delete(RestaurantType entity)
 {
     return _restaurantTypeRepository.Delete(entity);
 }