Exemplo n.º 1
0
 // GET: Student
 public ActionResult Students()
 {
     using (var context = new ShyjuDB())
     {
         var res      = context.p_GetStudent(0);
         var students = from s in res
                        where s.SchoolId != 2
                        select new SudentDTO
         {
             Id      = s.Id,
             Name    = s.Name,
             Address = s.Address,
             DOB     = s.DOB
         };
         return(View(students.ToList()));
     }
 }
Exemplo n.º 2
0
 private void button5_Click(object sender, EventArgs e)
 {
     try
     {
         using (var context = new ShyjuDB())
         {
             var res      = context.p_GetStudent(0).ToList();
             var students = from s in res
                            where s.SchoolId != 2
                            select new SudentDTO
             {
                 Id      = s.Id,
                 Name    = s.Name,
                 Address = s.Address,
                 DOB     = s.DOB
             };
             DataBind(students.ToList());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }