public ReviewModel CreateReviewModel(Review review, string msg) { return new ReviewModel() { ReviewId = review.ReviewId, Rating = (double)review.Rating == null ? 0.0: review.Rating, Comment = string.IsNullOrEmpty(review.Comment)==true?string.Empty:review.Comment, ReviewDate = review.ReviewDate == null ? DateTime.Now : review.ReviewDate, //UserId = review.UserId, // SegmentId = (int)review.SegmentId == null ? 0 : (int)review.SegmentId, // PlaceId = (int)review.PlaceId == null ? 0 : (int)review.PlaceId, // SectorId = (int)review.SectorId == null ? 0 : (int)review.SectorId, message = string.IsNullOrEmpty(msg) == true?string.Empty:msg }; }
public Review CreateReview(ReviewModel reviewModel) { try { var review = new Review() { ReviewId = reviewModel.ReviewId, Rating = reviewModel.Rating, Comment = reviewModel.Comment, ReviewDate = reviewModel.ReviewDate, UserId = (int)reviewModel.UserId, SegmentId = reviewModel.SegmentId, PlaceId = reviewModel.PlaceId, SectorId = reviewModel.SectorId }; return review; } catch (Exception) { throw null; } }