public async Task <IActionResult> CreateCostDetails(CostDetailsDTO costDetailsDto) { var costDetails = _mapper.Map <CostDetailsDTO, CostDetails>(costDetailsDto); await _repository.AddCostDetails(costDetails); return(Ok(costDetails)); }
public async Task <IActionResult> UpdateCostDetails(int id, CostDetailsDTO costDetailsDTO) { if (id != costDetailsDTO.Id) { return(BadRequest()); } try { var costDetails = _mapper.Map <CostDetailsDTO, CostDetails>(costDetailsDTO); await _repository.UpdateCostDetails(costDetails); } catch (DbUpdateConcurrencyException) { if (!await costDetailsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }