Beispiel #1
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();
     }
 }
Beispiel #2
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();
     }
 }
Beispiel #3
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;
 }
Beispiel #4
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);
        }