public async Task <IActionResult> UpdateLot(int id, [FromBody] LotCreateViewModel lotViewModel) { if (lotViewModel == null) { return(BadRequest(ModelState)); } AddValidationErrors(lotViewModel); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var updatedLot = _maper.Map <LotCreateViewModel, Lot>(lotViewModel); var result = await _lotService.UpdateLotAsync(id, updatedLot); if (result == null) { return(NotFound()); } return(Ok(_maper.Map <Lot, LotCreateViewModel>(result))); }