public async Task <Unit> Handle(UpdateJobTitleCommand request, CancellationToken cancellationToken) { _logger.LogInformation("Updating job title {@Id}, {@Name}, {@Description}", request.Id, request.Name, request.Description); var jobTitle = new JobTitle( id: request.Id, name: request.Name, description: request.Description ); await _jobTitleRepository.Update(jobTitle); return(Unit.Value); }
public IActionResult UpdateJobTitle(int id, [FromBody] JsonPatchDocument <JobTitleUpdateDto> jobtitle) { if (jobtitle == null) { return(BadRequest()); } var jobtitleFromRepo = _jobtitleRepository.GetSingle(id); if (jobtitleFromRepo == null) { return(NotFound()); } var jobtitleToPatch = Mapper.Map <JobTitleUpdateDto>(jobtitleFromRepo); jobtitle.ApplyTo(jobtitleToPatch, ModelState); TryValidateModel(jobtitleToPatch); if (!ModelState.IsValid) { return(new InputValidation(ModelState)); } Mapper.Map(jobtitleToPatch, jobtitleFromRepo); _jobtitleRepository.Update(jobtitleFromRepo); if (!_jobtitleRepository.Commit()) { throw new Exception("Creating Job Title Failed"); } return(NoContent()); }
public void Update(JobTitleViewModel jobTitleViewModel) { _jobTitleRepository.Update(_mapper.Map <JobTitle>(jobTitleViewModel)); _jobTitleRepository.SaveChanges(); }
public bool Update(JobTitle department, string jobCertTypeIds) { return(jobTitleRep.Update(department, jobCertTypeIds)); }