DocSas/PropertyService.Domain/ModelView/CommentCards/CommentCardProvider.cs
/// <summary>
/// save comment card as an asynchronous operation.
/// </summary>
/// <param name="commentCard">The comment card.</param>
/// <returns>Task&lt;DSCResponse&gt;.</returns>
save comment card as an asynchronous operation.
save comment card as an asynchronous operation .
public async Task<DSCResponse> SaveCommentCardAsync(CommentCardVM commentCard)
        {
            var msg = new Dictionary<string, string>();
            var response = new DSCResponse();
            var comment = _mapper.Map<CommentCardVM, CommentCard>(commentCard);
            if (comment != null)
            {
                await _commentCardRepo.AddAsync(comment);
                NotificationVM notification = new NotificationVM()
                {
                    UserId = comment.IsAnonymous ? Guid.Empty : comment.UserId,
                    PropertyInformationId = comment.PropertyInformationId,
                    NotificationResourceKey = NotificationResourceKeys.NotifyNewCommentCardReceieved,
                    NotificationTypeEnum = PSNotificationType.CommentCard.ToString(),
                    NotificationShowFor = PSNotificationShowFor.Property.ToString(),
                    NotificationTypeId = comment.Id,
                    NotificationAdditionalInfo = comment.IsAnonymous ? NotificationResourceKeys.NotifyAnonymousComment : Utility.GetShortTen(comment.Comment)
                };
                await _appCommon.AddNotification(notification);
            }
            response.ResponseData = comment;
            response.ErrorMessage = msg;
            return response;
        }
public async Task < DSCResponse > SaveCommentCardAsync ( CommentCardVM commentCard ) { var msg = new Dictionary < string , string > ( ) ; var response = new DSCResponse ( ) ; var comment = _mapper . Map < CommentCardVM , CommentCard > ( commentCard ) ; if ( comment != null ) { await _commentCardRepo . AddAsync ( comment ) ; NotificationVM notification = new NotificationVM ( ) { UserId = comment . IsAnonymous ? Guid . Empty : comment . UserId , PropertyInformationId = comment . PropertyInformationId , NotificationResourceKey = NotificationResourceKeys . NotifyNewCommentCardReceieved , NotificationTypeEnum = PSNotificationType . CommentCard . ToString ( ) , NotificationShowFor = PSNotificationShowFor . Property . ToString ( ) , NotificationTypeId = comment . Id , NotificationAdditionalInfo = comment . IsAnonymous ? NotificationResourceKeys . NotifyAnonymousComment : Utility . GetShortTen ( comment . Comment ) } ; await _appCommon . AddNotification ( notification ) ; } response . ResponseData = comment ; response . ErrorMessage = msg ; return response ; }
save comment card as an asynchronous operation.
save comment card as an asynchronous operation .
None
commentCard
CommentCardVM
The comment card.
The comment card .