public ActionResult UpdateContract(int id, ContractUpdateDto contractUpdateDto) { Response.Headers.Add("Access-Control-Allow-Origin", "*"); var contractModelFromRepo = _repository.GetContractById(id); if (contractModelFromRepo == null) { return(NotFound()); } _mapper.Map(contractUpdateDto, contractModelFromRepo); _repository.UpdateContract(contractModelFromRepo); _repository.SaveChanges(); return(NoContent()); }
public virtual async Task <ContractListDto> UpdateAsync(Guid employeeId, Guid contractId, ContractUpdateDto input) { return(await _contractAppService.UpdateAsync(employeeId, contractId, input)); }
public virtual async Task <ContractListDto> UpdateAsync(Guid employeeId, Guid contractId, ContractUpdateDto input) { Contract entity = await _contractRepository .GetAsync(c => c.EmployeeId == employeeId && c.Id == contractId); entity = ObjectMapper.Map(input, entity); entity = await _contractRepository.UpdateAsync(entity); return(ObjectMapper.Map <Contract, ContractListDto>(entity)); }