Beispiel #1
0
        protected virtual async Task CreateUserAsync(CreateOrEditCityDto input)
        {
            var entity = ObjectMapper.Map <City>(input);

            await cityRepository.InsertAndGetIdAsync(entity);

            await CurrentUnitOfWork.SaveChangesAsync();
        }
Beispiel #2
0
        protected virtual async Task UpdateAsync(CreateOrEditCityDto input)
        {
            var entity = await cityRepository.GetAll()
                         .FirstOrDefaultAsync(p => p.Id == input.Id);

            ObjectMapper.Map(input, entity);
            await cityRepository.UpdateAsync(entity);
        }
Beispiel #3
0
 //[AbpAuthorize(PermissionNames.AdminPage_City)]
 public async Task CreateOrUpdate(CreateOrEditCityDto input)
 {
     if (input.Id != 0)
     {
         await UpdateAsync(input);
     }
     else
     {
         await CreateUserAsync(input);
     }
 }
 public async Task CreateOrEdit(CreateOrEditCityDto input)
 {
     if (input.Id == null)
     {
         await Create(input);
     }
     else
     {
         await Update(input);
     }
 }
Beispiel #5
0
        protected virtual async Task Create(CreateOrEditCityDto input)
        {
            var city = ObjectMapper.Map <City>(input);


            if (AbpSession.TenantId != null)
            {
                city.TenantId = (int)AbpSession.TenantId;
            }


            await _cityRepository.InsertAsync(city);
        }
Beispiel #6
0
        public async Task <CreateOrEditCityDto> GetForEdit(int?id)
        {
            var model = new CreateOrEditCityDto();

            if (id == null)
            {
                return(model);
            }

            var entity = await cityRepository.GetAll()
                         .FirstOrDefaultAsync(p => p.Id == id);

            entity.MapTo(model);
            //model = model.Translations
            //    .Concat(translations)
            //    .DistinctBy(p => p.Language)
            //    .ToList();
            return(model);
        }
 private async Task Create(CreateOrEditCityDto input)
 {
     var city = ObjectMapper.Map <City>(input);
     await _cityRepository.InsertAsync(city);
 }
        private async Task Update(CreateOrEditCityDto input)
        {
            var city = await _cityRepository.FirstOrDefaultAsync((int)input.Id);

            ObjectMapper.Map(input, city);
        }