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