DocSas/PropertyService.Domain/ModelView/ServiceRequests/ServiceRequestProvider.cs
/// <summary>
/// save service request as an asynchronous operation.
/// </summary>
/// <param name="serviceRequest">The service request.</param>
/// <returns>Task&lt;DSCResponse&gt;.</returns>
save service request as an asynchronous operation.
save service request as an asynchronous operation .
public async Task<DSCResponse> SaveServiceRequestAsync(ServiceRequestVM serviceRequest)
        {
            var msg = new Dictionary<string, string>();
            var response = new DSCResponse();
            var srRequest = _mapper.Map<ServiceRequestVM, ServiceRequest>(serviceRequest);
            if (srRequest != null)
            {
                srRequest.IsValid = true;
                await _serviceRequestRepo.AddAsync(srRequest);
                NotificationVM notification = new NotificationVM()
                {
                    UserId = serviceRequest.UserId,
                    PropertyInformationId = serviceRequest.PropertyInformationId,
                     NotificationResourceKey =  NotificationResourceKeys.NotifyNewServiceRequested,
                     NotificationTypeEnum = PSNotificationType.ServiceRequest.ToString(),
                     NotificationShowFor = PSNotificationShowFor.Property.ToString(),
                     NotificationTypeId = srRequest.Id,
                     NotificationAdditionalInfo = string.Concat(srRequest.TenantUnitAddress, " - ", srRequest.Title)
                };
                await _appCommon.AddNotification(notification);
            }
            response.ResponseData = srRequest;
            response.ErrorMessage = msg;
            return response;
        }
public async Task < DSCResponse > SaveServiceRequestAsync ( ServiceRequestVM serviceRequest ) { var msg = new Dictionary < string , string > ( ) ; var response = new DSCResponse ( ) ; var srRequest = _mapper . Map < ServiceRequestVM , ServiceRequest > ( serviceRequest ) ; if ( srRequest != null ) { srRequest . IsValid = true ; await _serviceRequestRepo . AddAsync ( srRequest ) ; NotificationVM notification = new NotificationVM ( ) { UserId = serviceRequest . UserId , PropertyInformationId = serviceRequest . PropertyInformationId , NotificationResourceKey = NotificationResourceKeys . NotifyNewServiceRequested , NotificationTypeEnum = PSNotificationType . ServiceRequest . ToString ( ) , NotificationShowFor = PSNotificationShowFor . Property . ToString ( ) , NotificationTypeId = srRequest . Id , NotificationAdditionalInfo = string . Concat ( srRequest . TenantUnitAddress , " " , srRequest . Title ) } ; await _appCommon . AddNotification ( notification ) ; } response . ResponseData = srRequest ; response . ErrorMessage = msg ; return response ; }
save service request as an asynchronous operation.
save service request as an asynchronous operation .
None
serviceRequest
ServiceRequestVM
The service request.
The service request .