private async Task CreateSupportAsync(SupportCreateOrUpdateInput input) { var support = ObjectMapper.Map <Support>(input); support.UserId = AbpSession.UserId; await _supportRepository.InsertAsync(support); }
public async Task <SupportGetForEditOutput> GetSupportForEdit(NullableIdDto <int> input) { Support support = null; if (input.Id.HasValue) { support = await _supportRepository.GetAll() .Include(x => x.SupportType) .Include(x => x.SupportState) .FirstOrDefaultAsync(x => x.Id == input.Id.Value); } var output = new SupportGetForEditOutput(); //support var newSupport = new SupportCreateOrUpdateInput(); newSupport.CreationTime = newSupport.CreationTime.GetShamsi(); output.Support = support != null ? ObjectMapper.Map <SupportCreateOrUpdateInput>(support) : newSupport; //FirmTypes output.SupportTypes = _supportTypeRepository .GetAllList() .Select(c => new ComboboxItemDto(c.Id.ToString(), c.Name)) .ToList(); output.SupportStates = _supportStateRepository .GetAllList() .Select(c => new ComboboxItemDto(c.Id.ToString(), c.Name)) .ToList(); return(output); }
public async Task CreateOrUpdateSupport(SupportCreateOrUpdateInput input) { if (input.Id.HasValue) { await UpdateSupportAsync(input); } else { await CreateSupportAsync(input); } }
private async Task UpdateSupportAsync(SupportCreateOrUpdateInput input) { var support = ObjectMapper.Map <Support>(input); await _supportRepository.UpdateAsync(support); }