protected virtual async Task UpdateAsync(CreateOrEditJobCategoryDto input) { var entity = await jobCategoryRepository.GetAll() .FirstOrDefaultAsync(p => p.Id == input.Id); ObjectMapper.Map(input, entity); await jobCategoryRepository.UpdateAsync(entity); }
protected virtual async Task CreateUserAsync(CreateOrEditJobCategoryDto input) { var entity = ObjectMapper.Map <JobCategory>(input); await jobCategoryRepository.InsertAndGetIdAsync(entity); await CurrentUnitOfWork.SaveChangesAsync(); }
//[AbpAuthorize(PermissionNames.AdminPage_JobCategory)] public async Task CreateOrUpdate(CreateOrEditJobCategoryDto input) { if (input.Id != 0) { await UpdateAsync(input); } else { await CreateUserAsync(input); } }
public async Task <CreateOrEditJobCategoryDto> GetForEdit(int?id) { var model = new CreateOrEditJobCategoryDto(); if (id == null) { return(model); } var entity = await jobCategoryRepository.GetAll() .FirstOrDefaultAsync(p => p.Id == id); entity.MapTo(model); //model = model.Translations // .Concat(translations) // .DistinctBy(p => p.Language) // .ToList(); return(model); }