コード例 #1
0
        public int Update(CustomerIssues CustomerIssues, int id)
        {
            string sQry   = "UPDATE [CustomerIssues] SET [Issue]='" + CustomerIssues.Issue + "',[IssueTrackingDate]='" + CustomerIssues.IssueTrackingDate + "',[Amount]='" + CustomerIssues.Amount + "',[Status]='" + CustomerIssues.Status + "',[UserLastUpdated]='" + CustomerIssues.UserLastUpdated + "' WHERE [Id]=" + id;
            int    retVal = ExecuteCRUDByQuery(sQry);

            return(retVal);
        }
コード例 #2
0
        public int Add(CustomerIssues CustomerIssues)
        {
            string sQry = "INSERT INTO [CustomerIssues] ([Issue],[CreationDate],[IssueTrackingDate],[Status],[Amount], [UserLastUpdated]) " +
                          "VALUES('" + CustomerIssues.Issue + "','" + CustomerIssues.CreationDate + "','" + CustomerIssues.IssueTrackingDate + "','" +
                          CustomerIssues.Status + "','" + CustomerIssues.Amount + "','" + CustomerIssues.UserLastUpdated + "')";
            int retVal = ExecuteCRUDByQuery(sQry);

            return(retVal);
        }
コード例 #3
0
        public CustomerIssues Find(int id)
        {
            CustomerIssues CustomerIssues   = null;
            string         sQry             = "SELECT * FROM [CustomerIssues] WHERE [Id]=" + id;
            DataTable      dtCustomerIssues = ExecuteQuery(sQry);

            if (dtCustomerIssues != null)
            {
                DataRow dr = dtCustomerIssues.Rows[0];
                CustomerIssues = GetCustomerIssuesByRow(dr);
            }
            return(CustomerIssues);
        }
コード例 #4
0
        private CustomerIssues GetCustomerIssuesByRow(DataRow dr)
        {
            CustomerIssues CustomerIssues = new CustomerIssues();

            CustomerIssues.Id                = Convert.ToInt32(dr["Id"]);
            CustomerIssues.Amount            = dr["Amount"].ToString();
            CustomerIssues.CreationDate      = dr["CreationDate"].ToString();
            CustomerIssues.Issue             = dr["Issue"].ToString();
            CustomerIssues.IssueTrackingDate = dr["IssueTrackingDate"].ToString();
            CustomerIssues.Status            = dr["Status"].ToString();
            CustomerIssues.UserLastUpdated   = dr["UserLastUpdated"].ToString();
            return(CustomerIssues);
        }
コード例 #5
0
        public IActionResult GetCustomerIssuesById(int id)
        {
            CustomerIssues customerIssues = _customerIssuesService.Find(id);

            if (customerIssues == null)
            {
                return(NotFound());
            }
            else
            {
                return(new ObjectResult(customerIssues));
            }
        }
コード例 #6
0
        public IActionResult PostCustomerIssues([FromBody] CustomerIssues customerIssues)
        {
            if (customerIssues == null)
            {
                return(BadRequest());
            }
            int retVal = _customerIssuesService.Add(customerIssues);

            if (retVal > 0)
            {
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }
コード例 #7
0
        public IActionResult PatchCustomerIssues(int id, [FromBody] CustomerIssues customerIssues)
        {
            //if (customer == null || id != customer.Id) return BadRequest();
            if (_customerIssuesService.Find(id) == null)
            {
                return(NotFound());
            }
            int retVal = _customerIssuesService.Update(customerIssues, id);

            if (retVal > 0)
            {
                return(Ok());
            }
            else
            {
                return(NotFound());
            }
        }