public IActionResult Post([FromBody] InventoryRequestApiModel request) { try { var newRequest = request.ToDomainModel(); newRequest = _requestService.Add(newRequest); return(Ok(newRequest.ToApiModel())); } catch (Exception ex) { ModelState.AddModelError("GetAllRequestsError", ex.Message); return(NotFound(ModelState)); } }
public IActionResult Put(int id, [FromBody] InventoryRequestApiModel request) { try { var updatedRequest = request.ToDomainModel(); updatedRequest.Id = id; updatedRequest = _requestService.Update(updatedRequest); return(Ok(updatedRequest.ToApiModel())); } catch (Exception ex) { ModelState.AddModelError("GetAllRequestsError", ex.Message); return(NotFound(ModelState)); } }