public async Task <JobDto> Update(Guid id, CreateOrUpdateJobDto input) { var job = await _repository.GetAsync(id); job.Name = input.Name; job.Enabled = input.Enabled; job.Sort = input.Sort; job.Description = input.Description; return(ObjectMapper.Map <Job, JobDto>(job)); }
public async Task <JobDto> Create(CreateOrUpdateJobDto input) { var exist = await _repository.FirstOrDefaultAsync(_ => _.Name == input.Name); if (exist != null) { throw new BusinessException("名称:" + input.Name + "岗位已存在"); } var result = await _repository.InsertAsync(new Job(GuidGenerator.Create(), input.Name, input.Enabled, input.Sort, input.Description)); return(ObjectMapper.Map <Job, JobDto>(result)); }
public Task <JobDto> Update(Guid id, CreateOrUpdateJobDto input) { return(_jobAppService.Update(id, input)); }
public Task <JobDto> Create(CreateOrUpdateJobDto input) { return(_jobAppService.Create(input)); }