DocSas/PropertyService.Domain/ModelView/property/PropertyProvider.cs
/// <summary>
/// save hour as an asynchronous operation.
/// </summary>
/// <param name="hour">The hour.</param>
/// <returns>Task&lt;DSCResponse&gt;.</returns>
save hour as an asynchronous operation.
save hour as an asynchronous operation .
public async Task<DSCResponse> SaveHourAsync(HourVM hour)
        {
            var msg = new Dictionary<string, string>();
            var response = new DSCResponse();
            IEnumerable<OperationHour> hourEntity;
            if (hour != null && hour.Hours != null)
            {
                hourEntity = _mapper.Map<IEnumerable<OperationHour>>(hour.Hours);
                if (hour.Hours.First().Id == Guid.Empty)
                {
                    await _hourRepo.AddAsync(hourEntity);
                }
                else
                {
                    await _hourRepo.ModifyAsync(hourEntity);
                }
               var hourVm = _mapper.Map<IEnumerable<OperationHourVM>>(hourEntity);
                if (hourVm != null)
                {
                    hour.Hours = hourVm.ToList();
                    response.ResponseData = hour;
                }
            }
            response.ErrorMessage = msg;
            return response;
        }
public async Task < DSCResponse > SaveHourAsync ( HourVM hour ) { var msg = new Dictionary < string , string > ( ) ; var response = new DSCResponse ( ) ; IEnumerable < OperationHour > hourEntity ; if ( hour != null && hour . Hours != null ) { hourEntity = _mapper . Map < IEnumerable < OperationHour > > ( hour . Hours ) ; if ( hour . Hours . First ( ) . Id == Guid . Empty ) { await _hourRepo . AddAsync ( hourEntity ) ; } else { await _hourRepo . ModifyAsync ( hourEntity ) ; } var hourVm = _mapper . Map < IEnumerable < OperationHourVM > > ( hourEntity ) ; if ( hourVm != null ) { hour . Hours = hourVm . ToList ( ) ; response . ResponseData = hour ; } } response . ErrorMessage = msg ; return response ; }
save hour as an asynchronous operation.
save hour as an asynchronous operation .
None
hour
HourVM
None