示例#1
0
        // GET: Field/Details/5
        public ActionResult Details(int id)
        {
            var student = studentService.GetStudentById(id);
            StudentListingVM studentListingVM = new StudentListingVM()
            {
                ID           = student.ID,
                Name         = student.Name,
                BirthDate    = student.BirthDate.ToString("dd-MM-yyyy"),
                Field        = student.Field.Name,
                Governorate  = student.Governorate.Name,
                Neighborhood = student.Neighborhood.Name
            };

            return(View(studentListingVM));
        }
示例#2
0
        public JsonResult GetStudentList()
        {
            List <StudentListingVM> studentListingVM = new List <StudentListingVM>();

            studentService.GetAllStudents().ToList().ForEach(c => {
                StudentListingVM studentListing = new StudentListingVM
                {
                    ID           = c.ID,
                    Name         = c.Name,
                    BirthDate    = c.BirthDate.ToString("dd-MM-yyyy"),
                    Field        = c.Field.Name,
                    Governorate  = c.Governorate.Name,
                    Neighborhood = c.Neighborhood.Name
                };
                studentListingVM.Add(studentListing);
            });

            return(Json(studentListingVM, JsonRequestBehavior.AllowGet));
        }