Ejemplo n.º 1
0
        private async Task CreateSupportAsync(SupportCreateOrUpdateInput input)
        {
            var support = ObjectMapper.Map <Support>(input);

            support.UserId = AbpSession.UserId;
            await _supportRepository.InsertAsync(support);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
 public async Task CreateOrUpdateSupport(SupportCreateOrUpdateInput input)
 {
     if (input.Id.HasValue)
     {
         await UpdateSupportAsync(input);
     }
     else
     {
         await CreateSupportAsync(input);
     }
 }
Ejemplo n.º 4
0
 private async Task UpdateSupportAsync(SupportCreateOrUpdateInput input)
 {
     var support = ObjectMapper.Map <Support>(input);
     await _supportRepository.UpdateAsync(support);
 }