/// <summary> /// Add Business Rating /// </summary> /// <returns></returns> public BusinessVM AddBusinessRating(BusinessRatingVM _businessRatingVM) { BusinessRating _businessRating = new BusinessRating { BusinessID = _businessRatingVM.BusinessID, UserID = _businessRatingVM.UserID, Rating = Convert.ToDouble(_businessRatingVM.Rating), Review = _businessRatingVM.Review }; _objBusinessDAL.AddBusinessRating(_businessRating); return(GetBusinessDetails(_businessRatingVM.BusinessID)); }
/// <summary> /// Add Business Rating /// </summary> /// <returns></returns> public BusinessVM AddBusinessRating(BusinessRatingVM _businessRatingVM) { BusinessRating _businessRating = new BusinessRating { UserID = _businessRatingVM.UserID, Rating = Convert.ToDouble(_businessRatingVM.Rating), Review = _businessRatingVM.Review }; if (string.IsNullOrEmpty(_businessRatingVM.PlaceID)) { _businessRating.BusinessID = _businessRatingVM.BusinessID; _businessRating.PlaceID = null; } else { _businessRating.BusinessID = null; _businessRating.PlaceID = _businessRatingVM.PlaceID; } _objBusinessDAL.AddBusinessRating(_businessRating); if (!string.IsNullOrEmpty(_businessRatingVM.PlaceID)) { String googlePlaceURL = ConfigurationManager.AppSettings["GooglePlaceAPIReviewURL"] + _businessRatingVM.PlaceID + "&key=" + ConfigurationManager.AppSettings["GooglePlaceAPIKey"]; using (var client = new WebClient()) using (var stream = client.OpenRead(googlePlaceURL)) using (var reader = new StreamReader(stream)) using (var jsonData = new JsonTextReader(reader)) { return(BusinessPlaceDetails(JObject.Load(jsonData)["result"], _businessRatingVM.UserID)); } } else { return(GetBusinessDetails(_businessRatingVM.BusinessID)); } }