public bool AddRestaurantRating(RestaurantRating restaurantRating, out RestaurantRating returnedRestaurantRating) { try { if (restaurantRating.RestaurantId < 1) { throw new Exception("Entity Error : Restaurant Id cannot be less than one"); } if (string.IsNullOrEmpty(restaurantRating.RestaurantId.ToString())) { throw new Exception("Entity Error : Restaurant Id cannot be empty"); } if (string.IsNullOrEmpty(restaurantRating.rating)) { throw new Exception("Entity Error : Rating cannot be empty"); } DataLayer.DataEntity.RestaurantRating ratingForDataLayer = new DataLayer.DataEntity.RestaurantRating() { RestaurantId = restaurantRating.RestaurantId, rating = restaurantRating.rating, user_Comments = restaurantRating.user_Comments }; DataLayer.DataEntity.RestaurantRating returnedRating = new DataLayer.DataEntity.RestaurantRating(); bool isSuccess = _ratingRepository.AddRestaurantRating(ratingForDataLayer, out returnedRating); returnedRestaurantRating = new RestaurantRating() { RatingId = returnedRating.RatingId, RestaurantId = returnedRating.RestaurantId, rating = returnedRating.rating, user_Comments = returnedRating.user_Comments }; return(isSuccess); } catch (Exception ex) { throw new Exception(ex.Message); } }