コード例 #1
0
        public IActionResult Delete(Guid id)
        {
            JTFA_Invoice jtfa_Invoice = this._dataRepository.Get(id);

            if (jtfa_Invoice == null)
            {
                return(NotFound("The Invoice record couldn't be found."));
            }

            this._dataRepository.Delete(jtfa_Invoice);
            return(NoContent());
        }
コード例 #2
0
        public IActionResult Get_JTFA_Invoice(Guid id)
        {
            JTFA_Invoice jtfa_Invoice = null;

            if (id != null || id == Guid.Empty)
            {
                jtfa_Invoice = this._dataRepository.Get(id);
                if (jtfa_Invoice == null)
                {
                    return(NotFound("The Invoice record couldn't be found."));
                }
            }
            return(Ok(jtfa_Invoice));
        }
コード例 #3
0
        public IActionResult Update(Guid id, [FromBody] JTFA_Invoice jtfa_Invoice)
        {
            if (jtfa_Invoice == null)
            {
                return(BadRequest("Invoice is Null"));
            }

            JTFA_Invoice jTFA_Invoice_ToUpdate = _dataRepository.Get(id);

            if (jTFA_Invoice_ToUpdate == null)
            {
                return(NotFound("The invoice record couldn't be found."));
            }

            this._dataRepository.Update(jTFA_Invoice_ToUpdate, jtfa_Invoice);
            return(NoContent());
        }
コード例 #4
0
        public IActionResult Post([FromBody] JTFA_Invoice jtfa_Invoice, ApiVersion apiVersion)
        {
            if (jtfa_Invoice == null)
            {
                return(BadRequest("Invoice is null."));
            }

            this._dataRepository.Add(jtfa_Invoice);
            CreatedAtRouteResult response = null;

            try
            {
                // First param describes the name of the get method to get the item after its created
                response = CreatedAtRoute("GetJTFA_Invoice", new { id = jtfa_Invoice.JTFA_Invoice_ID, version = apiVersion.ToString() }, jtfa_Invoice);
            }
            catch (Exception ex)
            {
            }

            return(response);
        }