Example #1
0
 // DELETE api/<controller>/5
 public void Delete(int id)
 {
     using (var db = new AM234())
     {
         Form form = db.Forms.First(f => f.Id == id);
         db.Forms.Remove(form);
         db.SaveChanges();
     }
 }
Example #2
0
 // PUT api/<controller>/5
 public void Put(int id, [FromBody]FormTo to)
 {
     using (var db = new AM234())
     {
         Form form = db.Forms.First(f => f.Id == id);
         form.name = to.name;
         db.SaveChanges();
     }
 }
Example #3
0
 // PUT api/<controller>/5
 public void Put(int id, [FromBody] FormTo to)
 {
     using (var db = new AM234())
     {
         Form form = db.Forms.First(f => f.Id == id);
         form.name = to.name;
         db.SaveChanges();
     }
 }
Example #4
0
 // DELETE api/<controller>/5
 public void Delete(int id)
 {
     using (var db = new AM234())
     {
         Form form = db.Forms.First(f => f.Id == id);
         db.Forms.Remove(form);
         db.SaveChanges();
     }
 }
Example #5
0
 // POST api/<controller>
 public void Post([FromBody] FormTo to)
 {
     using (var db = new AM234())
     {
         Form form = new Form();
         form.name = to.name;
         db.Forms.Add(form);
         db.SaveChanges();
     }
 }
Example #6
0
 // POST api/<controller>
 public void Post([FromBody]FormTo to)
 {
     using (var db = new AM234())
     {
         Form form = new Form();
         form.name = to.name;
         db.Forms.Add(form);
         db.SaveChanges();
     }
 }
Example #7
0
 // GET api/<controller>
 public List<FormTo> Get()
 {
     List<FormTo> formsTo = new List<FormTo>();
     using (var db = new AM234() )
     {
         var forms = from f in db.Forms select f;
         foreach (Form form in forms)
         {
             FormTo to = new FormTo(form.Id, form.name);
             formsTo.Add(to);
         }
     }
     return formsTo;
 }
Example #8
0
        // GET api/<controller>
        public List <FormTo> Get()
        {
            List <FormTo> formsTo = new List <FormTo>();

            using (var db = new AM234())
            {
                var forms = from f in db.Forms select f;
                foreach (Form form in forms)
                {
                    FormTo to = new FormTo(form.Id, form.name);
                    formsTo.Add(to);
                }
            }
            return(formsTo);
        }