// GET api/<controller>/5 public StudentApiModel Get(int id) { StudentApiModel student = new StudentApiModel(); student.get(id); return(student); }
// GET api/<controller> public List <StudentApiModel> Get() { List <StudentApiModel> students = new List <StudentApiModel>(); StudentApiModel s1 = new StudentApiModel(); //string sql = "select * from Std_Student"; DataTable dt = s1.getList(); // List<Student> retval = new List<Student>(); foreach (DataRow dr in dt.Rows) { StudentApiModel s = new StudentApiModel(); s.get(Convert.ToInt32(dr["ID"])); students.Add(s); } return(students); }