Example #1
0
        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());
        }
Example #2
0
 public virtual async Task <ContractListDto> UpdateAsync(Guid employeeId, Guid contractId, ContractUpdateDto input)
 {
     return(await _contractAppService.UpdateAsync(employeeId, contractId, input));
 }
Example #3
0
        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));
        }