// PUT: api/TuKhoaPhuong/5 public HttpResponseMessage Put([FromBody] TuKhoaPhuong tkp) { TuKhoaPhuongDAO daO = new TuKhoaPhuongDAO(); bool result = daO.updateTuKhoaPhuong(tkp.MaTuKhoaPhuong, tkp.TuKhoaPhuong1); var response = Request.CreateResponse <bool>(HttpStatusCode.Created, result); return(response); }
// POST: api/TuKhoaPhuong public HttpResponseMessage Post([FromBody] TuKhoaPhuong tkp) { TuKhoaPhuongDAO daO = new TuKhoaPhuongDAO(); bool result = daO.insertTuKhoaPhuong(tkp); var response = Request.CreateResponse <bool>(HttpStatusCode.Created, result); // response.Headers.Location = new System.Uri(Request.RequestUri, "/api/DiaDiem/" + tenDD.MaTenDiaDiem.ToString()); return(response); }
// GET: api/TuKhoaPhuong public HttpResponseMessage Get() { try { TuKhoaPhuongDAO daO = new TuKhoaPhuongDAO(); TuKhoaPhuong[] result = new TuKhoaPhuong[daO.getDsTuKhoaPhuong().Count]; result = daO.getDsTuKhoaPhuong().ToArray(); var response = Request.CreateResponse <IEnumerable <TuKhoaPhuong> >(HttpStatusCode.Created, result); return(response); } catch (Exception e) { throw new HttpResponseException(HttpStatusCode.NotFound); } }