// POST api/<controller> public void Post([FromBody]Form newForm) { using (var db = new DDD()) { db.Forms.Add(newForm); db.SaveChanges(); } }
// POST api/<controller> public void Post([FromBody] Form newForm) { using (var db = new DDD()) { db.Forms.Add(newForm); db.SaveChanges(); } }
// PUT api/<controller>/5 public void Put(int id, [FromBody]Form newForm) { using (var db = new DDD()) { var form = db.Forms.First(f => f.Id == id); form.name = newForm.name; db.SaveChanges(); } }
// DELETE api/<controller>/5 public void Delete(int id) { using (var db = new DDD()) { var form = db.Forms.First(f => f.Id == id); db.Forms.Remove(form); db.SaveChanges(); } }
// PUT api/<controller>/5 public void Put(int id, [FromBody] Form newForm) { using (var db = new DDD()) { var form = db.Forms.First(f => f.Id == id); form.name = newForm.name; db.SaveChanges(); } }