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); }
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); }
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); }
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); }
public IActionResult GetCustomerIssuesById(int id) { CustomerIssues customerIssues = _customerIssuesService.Find(id); if (customerIssues == null) { return(NotFound()); } else { return(new ObjectResult(customerIssues)); } }
public IActionResult PostCustomerIssues([FromBody] CustomerIssues customerIssues) { if (customerIssues == null) { return(BadRequest()); } int retVal = _customerIssuesService.Add(customerIssues); if (retVal > 0) { return(Ok()); } else { return(NotFound()); } }
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()); } }