Example #1
0
        protected virtual async Task UpdateAsync(CreateOrEditJobDto input)
        {
            var entity = await jobRepository.GetAll()
                         .FirstOrDefaultAsync(p => p.Id == input.Id);

            ObjectMapper.Map(input, entity);
            await jobRepository.UpdateAsync(entity);
        }
Example #2
0
        protected virtual async Task CreateUserAsync(CreateOrEditJobDto input)
        {
            var entity = ObjectMapper.Map <Job>(input);

            await jobRepository.InsertAndGetIdAsync(entity);

            await CurrentUnitOfWork.SaveChangesAsync();
        }
Example #3
0
 //[AbpAuthorize(PermissionNames.AdminPage_Job)]
 public async Task CreateOrUpdate(CreateOrEditJobDto input)
 {
     if (input.Id != 0)
     {
         await UpdateAsync(input);
     }
     else
     {
         await CreateUserAsync(input);
     }
 }
Example #4
0
        public async Task <CreateOrEditJobDto> GetForEdit(int?id)
        {
            var model = new CreateOrEditJobDto();

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

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

            entity.MapTo(model);
            //model = model.Translations
            //    .Concat(translations)
            //    .DistinctBy(p => p.Language)
            //    .ToList();
            return(model);
        }