Example #1
0
        public ActionResult Details(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var corporation = _corporationService.Find(x => x.Id == id);

            if (corporation == null)
            {
                return(HttpNotFound());
            }

            var ownerId = corporation.CorporationOwnerId;

            DetailsViewModel model = new DetailsViewModel();

            model.Corporation = corporation;
            model.Owner       = _corporationOwnerService.Find(x => x.Id == corporation.CorporationOwnerId);
            model.Teachers    = _corporationTeacherService.ListWithDetails(x => x.CorporationId == corporation.Id).Select(t => t.Teacher).ToList();
            model.Employees   = _corporationEmployeeService.ListWithDetails(x => x.CorporationId == corporation.Id).Select(e => e.Employee).ToList();

            model.SchoolManagers = _corporationSchoolManagerService.ListWithDetails(x => x.CorporationId == corporation.Id).Select(s => s.SchoolManager).ToList();
            model.Students       = _corporationStudentService.ListWithDetails(x => x.CorporationId == corporation.Id).Select(s => s.Student).ToList();
            model.Addresses      = _corporationAddressService.List(x => x.CorporationId == corporation.Id);
            model.Classrooms     = _classroomService.List(x => x.CorporationId == corporation.Id);

            model.Educations = _educationService.List(x => x.CorporationId == corporation.Id);


            return(View(model));
        }