Пример #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();
     }
 }
Пример #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();
     }
 }
Пример #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();
     }
 }
Пример #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();
     }
 }
Пример #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();
     }
 }
Пример #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();
     }
 }
Пример #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;
 }
Пример #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);
        }