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