public async Task <IActionResult> Post([FromBody] CarHistoryDto dto) { var input = _mapper.Map <CarHistoryModel>(dto); input.OwnerId = GetUserId(); var model = await _carHistoryRepository.CreateAsync(input); return(CreatedAtRoute("GetCarHistoryById", new { id = model.Id }, _mapper.Map <CarHistoryDto>(model))); }
public async Task <IActionResult> Put(string id, [FromBody] CarHistoryDto dto) { if (string.IsNullOrEmpty(id)) { return(BadRequest()); } var input = _mapper.Map <CarHistoryModel>(dto); input.OwnerId = GetUserId(); await _carHistoryRepository.UpdateAsync(id, input, GetUserId()); return(NoContent()); }