コード例 #1
0
        public ActionResult <RequestStatus> PostRequestStatus(RequestStatus requestStatus)
        {
            _requestStatusRepository.Add(requestStatus);
            _requestStatusRepository.Save();

            return(CreatedAtAction("GetRequestStatus", new { id = requestStatus.Id }, requestStatus));
        }
コード例 #2
0
        public IActionResult CreateRequest([FromBody] Request request)
        {
            if (request == null)
            {
                return(BadRequest());
            }

            _repository.Add(request);
            RequestStatus status = new RequestStatus()
            {
                Id        = request.Id,
                Status    = RequestStatusTypes.InTransit,
                SourceId  = "SERVER_ID",
                Timestamp = DateTime.UtcNow,
            };

            _statusRepository.Add(status);

            return(CreatedAtRoute("GetRequest", new { id = request.Key }, request));
        }