public bool Post(ReviewRequest request) { bool retVal = false; if (request != null) { var review = new ReviewData() {FromCID = request.FromCID, AboutCID = request.AboutCID, Feedback = request.Feedback, Rate = request.Rate}; retVal = DAL.Instance.AddReview(review); } return retVal; }
public bool AddReview(ReviewData review) { bool retVal = false; User fromUser = GetUserByCID(review.FromCID); User aboutUser = GetUserByCID(review.AboutCID); if (fromUser != null && aboutUser != null) { review.Id = CreateReviewId(); review.Date = new DateTime(); ReviewIdToReviewDataDic.Add(review.Id, review); if (CIDToUserDataDic.ContainsKey(fromUser.CID)) { if (CIDToUserDataDic[fromUser.CID].ReviewIdFromUserList == null) { CIDToUserDataDic[fromUser.CID].ReviewIdFromUserList = new List<int>(); } CIDToUserDataDic[fromUser.CID].ReviewIdFromUserList.Add(review.Id); } if (CIDToUserDataDic.ContainsKey(aboutUser.CID)) { if (CIDToUserDataDic[aboutUser.CID].ReviewIdAboutUserList == null) { CIDToUserDataDic[aboutUser.CID].ReviewIdAboutUserList = new List<int>(); } CIDToUserDataDic[aboutUser.CID].ReviewIdAboutUserList.Add(review.Id); } retVal = true; //TBD - notify about the review // NotifiySubscribers(item.ProductId, item); } return retVal; }