Exemple #1
0
		public ListResult<Restaurant> GetRestaurantsByCity( string city ) {
			ListResult<Restaurant> result = new ListResult<Restaurant>();

			List<Restaurant> list = new List<Restaurant>();
			try {
				list = ctx.Restaurant.Where( r => r.City.ToLower().Contains( city.ToLower() ) ).ToList();

				if ( list.Count > 0 )
					result.LoadList( list );
				else {
					result.Status = "No restaurants found in " + city;
				}
			}
			catch ( Exception except ) {
				result.Status = except.InnerException != null ? except.InnerException.Message : except.Message;
			}

			return result;
		}
Exemple #2
0
		public ListResult<Review> GetReviewsByUser( string user ) {
			ListResult<Review> result = new ListResult<Review>();

			List<Review> list = new List<Review>();
			try {
				list = ctx.Review.Where( r => r.UserId.ToLower() == user.ToLower() ).ToList();

				if ( list.Count > 0 )
					result.LoadList( list );
				else {
					result.Status = "No reviews found for " + user;
				}
			}
			catch ( Exception except ) {
				result.Status = except.InnerException.Message;
			}

			return result;
		}