public void Create(UnusualRequests item) { var insert = database.GetCommand("INSERT INTO Requests(FullName, IllogicalRequest, Occurance) VALUES (@fn,@ir,@oc)"); database.ExecuteInsert(insert, new SQLiteParameter() { ParameterName = "@fn", Value = item.FullName }, new SQLiteParameter() { ParameterName = "@ir", Value = item.QuestionOrRequest }, new SQLiteParameter() { ParameterName = "@oc", Value = item.Occurrence }); }
public void Update(UnusualRequests item) { var insert = database.GetCommand("UPDATE Requests SET FullName = @fn, IllogicalRequest = @ir, Occurance = @oc WHERE Id = @id"); database.ExecuteInsert(insert, new SQLiteParameter() { ParameterName = "@fn", Value = item.FullName }, new SQLiteParameter() { ParameterName = "@ir", Value = item.QuestionOrRequest }, new SQLiteParameter() { ParameterName = "@oc", Value = item.Occurrence }, new SQLiteParameter() { ParameterName = "@id", Value = item.RequestId }); }
public IHttpActionResult Create([FromBody] UnusualRequests req) { if (req == null) { //Cannot create with no data return(BadRequest()); } RequestRepo.Create(req); return(new System.Web.Http.Results.OkResult(this)); }
private List <UnusualRequests> Parse(DataTable results) { List <UnusualRequests> data = new List <UnusualRequests>(); foreach (DataRow row in results.Rows) { UnusualRequests ur = new UnusualRequests(); ur.RequestId = int.Parse(row.ItemArray[0].ToString()); ur.FullName = row.ItemArray[1].ToString(); ur.QuestionOrRequest = row.ItemArray[2].ToString(); ur.Occurrence = DateTime.Parse(row.ItemArray[3].ToString()); data.Add(ur); } return(data); }
public IHttpActionResult Update(int id, [FromBody] UnusualRequests req) { if (req == null) { //need data to process an update return(BadRequest()); } if (RequestRepo.GetById(id) == null) { //This record does not exist return(NotFound()); } RequestRepo.Update(req); return(new System.Web.Http.Results.OkResult(this)); }
public void Create(UnusualRequests item) { var insert = database.GetCommand("INSERT INTO Requests(FullName, IllogicalRequest, Occurance) VALUES (@fn,@ir,@oc)"); database.ExecuteInsert(insert, new SQLiteParameter() { ParameterName = "@fn", Value = item.FullName }, new SQLiteParameter() { ParameterName = "@ir", Value = item.QuestionOrRequest }, new SQLiteParameter() { ParameterName = "@oc", Value = item.Occurrence }); }
public void Update(UnusualRequests item) { var insert = database.GetCommand("UPDATE Requests SET FullName = @fn, IllogicalRequest = @ir, Occurance = @oc WHERE Id = @id"); database.ExecuteInsert(insert, new SQLiteParameter() { ParameterName = "@fn", Value = item.FullName }, new SQLiteParameter() { ParameterName = "@ir", Value = item.QuestionOrRequest }, new SQLiteParameter() { ParameterName = "@oc", Value = item.Occurrence }, new SQLiteParameter() { ParameterName = "@id", Value = item.RequestId }); }
private List<UnusualRequests> Parse(DataTable results) { List<UnusualRequests> data = new List<UnusualRequests>(); foreach (DataRow row in results.Rows) { UnusualRequests ur = new UnusualRequests(); ur.RequestId = int.Parse(row.ItemArray[0].ToString()); ur.FullName = row.ItemArray[1].ToString(); ur.QuestionOrRequest = row.ItemArray[2].ToString(); ur.Occurrence = DateTime.Parse(row.ItemArray[3].ToString()); data.Add(ur); } return data; }