// ***************************************************************// // A future enhancement will be to switch this o a SQL Server / Entity Framework Backend // At that time, full CRUD operations will be implemented. // ***************************************************************// // POST api/values public void Post([FromBody] Data.HelloWorld value) { //try //{ // using (Uow db = new Uow(new DataContext())) // { //value.CreatedOn = DateTime.Now; //value.CreatedBy = "SYSTEM"; //db.HelloWorlds.Add(value); //db.Commit(); // } // catch (Exception e) //{ // Log Exception //} }
// GET api/values/1 public string Get(int id) { try { Data.HelloWorld helloWorld = new Data.HelloWorld(); using (Uow db = new Uow(new DataContext())) { helloWorld = db.HelloWorlds.Get(id); } return(helloWorld.Message); } catch (Exception e) { Console.WriteLine(e.Message); return("Not Found"); } }
// PUT api/values/5 public void Put(int id, [FromBody] Data.HelloWorld value) { //try //{ // using (Uow db = new Uow(new DataContext())) // { //***Future Enhancement*** SQL Server Entity Framework Backend //Data.HelloWorld helloWorld = new Data.HelloWorld(); //helloWorld = db.HelloWorlds.Get(id); //helloWorld.Message = value.Message; ' //db.HelloWorlds.Update(helloWorld); //db.Commit(); // }; //} //catch (Exception e) //{ // Log Exception //} }