// GET api/<controller>/5 public Form Get(int id) { Form form = new Form(); using (var db = new FMEntities()) { var ff = db.Forms.First(f => f.Id == id); form.Id = ff.Id; form.name = ff.name; } return form; }
// GET api/<controller> public IEnumerable<Form> Get() { List<Form> forms = new List<Form>(); using(var db = new FMEntities()) { var fs = from f in db.Forms select f; foreach(Form ff in fs) { Form form = new Form(); form.Id = ff.Id; form.name = ff.name; forms.Add(form); } } return forms; }