DocSas/PropertyService.Domain/ModelView/Reviews/ReviewProvider.cs
/// <summary>
/// save review as an asynchronous operation.
/// </summary>
/// <param name="reviewVM">The review vm.</param>
/// <returns>Task&lt;DSCResponse&gt;.</returns>
save review as an asynchronous operation.
save review as an asynchronous operation .
public async Task<DSCResponse> SaveReviewAsync(ReviewVM reviewVM)
        {
            var msg = new Dictionary<string, string>();
            var response = new DSCResponse();
            var review = _mapper.Map<ReviewVM, PropertyReview>(reviewVM);
            if (review != null)
            {
                await _reviewRepo.AddAsync(review);
                NotificationVM notification = new NotificationVM()
                {
                    UserId = review.UserId,
                    PropertyInformationId = review.PropertyInformationId,
                    NotificationResourceKey = NotificationResourceKeys.NotifyNewReviewAdded,
                    NotificationTypeEnum = PSNotificationType.Review.ToString(),
                    NotificationShowFor = PSNotificationShowFor.Property.ToString(),
                    NotificationTypeId = review.Id,
                    NotificationAdditionalInfo =  Utility.GetShortTen(review.Title)
                };
                await _appCommon.AddNotification(notification);
            }
            response.ResponseData = review;
            response.ErrorMessage = msg;
            return response;
        }
public async Task < DSCResponse > SaveReviewAsync ( ReviewVM reviewVM ) { var msg = new Dictionary < string , string > ( ) ; var response = new DSCResponse ( ) ; var review = _mapper . Map < ReviewVM , PropertyReview > ( reviewVM ) ; if ( review != null ) { await _reviewRepo . AddAsync ( review ) ; NotificationVM notification = new NotificationVM ( ) { UserId = review . UserId , PropertyInformationId = review . PropertyInformationId , NotificationResourceKey = NotificationResourceKeys . NotifyNewReviewAdded , NotificationTypeEnum = PSNotificationType . Review . ToString ( ) , NotificationShowFor = PSNotificationShowFor . Property . ToString ( ) , NotificationTypeId = review . Id , NotificationAdditionalInfo = Utility . GetShortTen ( review . Title ) } ; await _appCommon . AddNotification ( notification ) ; } response . ResponseData = review ; response . ErrorMessage = msg ; return response ; }
save review as an asynchronous operation.
save review as an asynchronous operation .
None
reviewVM
ReviewVM
The review vm.
The review vm .