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); }
protected virtual async Task CreateUserAsync(CreateOrEditJobDto input) { var entity = ObjectMapper.Map <Job>(input); await jobRepository.InsertAndGetIdAsync(entity); await CurrentUnitOfWork.SaveChangesAsync(); }
//[AbpAuthorize(PermissionNames.AdminPage_Job)] public async Task CreateOrUpdate(CreateOrEditJobDto input) { if (input.Id != 0) { await UpdateAsync(input); } else { await CreateUserAsync(input); } }
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); }