Esempio n. 1
0
        public void InsertGradeWithStrudent()
        {
            //Arrange
            var gradeModel = testContext.CrudFacadeSUT.InitializeNew();

            gradeModel.Name    = "Freshman";
            gradeModel.Section = "High school";

            var unitOfWork        = testContext.UnitOfWork;
            var studentCRUDFacade = new CrudFacade <StudentEntity, StudentListModel, StudentDetailModel>(unitOfWork,
                                                                                                         new RepositoryBase <StudentEntity>(unitOfWork), new StudentMapper());

            var studentModel = new StudentListModel
            {
                Name = "Tony"
            };

            gradeModel.Students = new List <StudentListModel>
            {
                studentModel
            };

            //Act
            var savedGradeModel = testContext.CrudFacadeSUT.Save(gradeModel);

            //Assert
            Assert.Equal(gradeModel, savedGradeModel, new GradeDetailModelEqualityComparer());
            Assert.Equal(studentModel, studentCRUDFacade.GetAllList().FirstOrDefault(s => s.Name == "Tony"), new StudentListModelEqualityComparer());
        }
        //
        // GET: /StudentDetails/
        public ActionResult Index()
        {
            StudentListModel obmodel = new StudentListModel();

            obmodel.StudentListCollection = new List <StudentList>();
            obmodel.StudentListCollection = GetStudentList();
            return(View(obmodel));
        }
Esempio n. 3
0
 void bindList(StudentListModel model)
 {
     model.ClassIdSelect = ClassMBiz.GetAll().Select(s => new SelectListItem
     {
         Value = s.Id,
         Text  = s.Name
     });
 }
        public static SpecificationResult IsSatisfiedBy(StudentListModel studentAddUpdateModel, Expression <Func <StudentBl, bool> > predicate)
        {
            var spec = Specification.NotNull <Expression <Func <StudentBl, bool> > >();

            var specificationResult = new SpecificationResult();

            spec.IsSatisfiedBy(predicate, out specificationResult);

            return(specificationResult);
        }
Esempio n. 5
0
        public ActionResult List()
        {
            if (!_permissionService.Authorize("ManageStudents"))
            {
                return(AccessDeniedView());
            }

            var model = new StudentListModel();

            return(View(model));
        }
Esempio n. 6
0
        public ActionResult Index()
        {
            var model = new StudentListModel();
            var list  = StudentBiz.QueryData(" ", " ");

            int currentPageIndex = 0;

            model.List = new MvcPaging.PagedList <StudentInfo>(list, currentPageIndex, 2);

            bindList(model);

            return(View(model));
        }
Esempio n. 7
0
        public ActionResult <StudentListModel> ViewSibling(StudentListModel studentListModel)
        {
            StudentListModel studentList = new StudentListModel();

            try
            {
                studentList = _studentService.ViewAllSibling(studentListModel);
            }
            catch (Exception es)
            {
                studentList._message = es.Message;
                studentList._failure = true;
            }
            return(studentList);
        }
Esempio n. 8
0
        //UniversityDatabase _db = new UniversityDatabase();

        public IActionResult StudentView()
        {
            //Add stuff to the model
            //Turn into students
            //List<StudentModel> students = _studentService.ConvertToStudentList(Dt);
            List <StudentModel> students = DummyData.DummyStudents.getDummyStudentList();

            //Validate
            List <string> errors = _validatorService.validateStudents(students);

            var model = new StudentListModel
            {
                Students = students,
                Errors   = errors
            };

            return(View(model));
        }
        public ActionResult Index(int?page)
        {
            StudentListModel model = new StudentListModel();

            var list = StudentBiz.GetAll();

            int currentPageIndex = page.HasValue ? page.Value - 1 : 0;
            int pageSize         = 2;

            while (currentPageIndex > 0 &&
                   list.Count <= currentPageIndex * pageSize)
            {
                currentPageIndex--;
            }

            model.List = new MvcPaging.PagedList <StudentInfo>(list, currentPageIndex, pageSize);

            bindList(model);

            return(View(model));
        }
Esempio n. 10
0
        public ActionResult Index(StudentListModel model, string sortCol, bool?sortDesc, int?page)
        {
            model.Name    = string.IsNullOrWhiteSpace(model.Name) ? "" : model.Name;
            model.ClassId = string.IsNullOrWhiteSpace(model.ClassId) ? "" : model.ClassId;
            var list = StudentBiz.QueryData(model.ClassId, model.Name);

            if (!string.IsNullOrWhiteSpace(sortCol))
            {
                ListSort <StudentInfo> .GetList(list, sortCol, sortDesc.Value);
            }

            int currentPageIndex = page.HasValue ? page.Value - 1 : 0;
            int pageSize         = 2;

            while (currentPageIndex > 0 &&
                   list.Count <= currentPageIndex * pageSize)
            {
                currentPageIndex--;
            }

            model.List = new MvcPaging.PagedList <StudentInfo>(list, currentPageIndex, pageSize);

            return(PartialView("List", model.List));
        }
Esempio n. 11
0
 public DeleteStudentMessage(StudentListModel student)
 {
     Student = student;
 }
Esempio n. 12
0
 public SelectStudentMessage(StudentListModel studentListModel)
 {
     StudentListModel = studentListModel;
 }
Esempio n. 13
0
 public NewStudentMessage(StudentListModel studentListModel)
 {
     StudentListModel = studentListModel;
 }
 public void EditStudent(StudentListModel student)
 {
     Students.RowEditOptions.EditRowId = student.Id;
 }
 public void UpdateStudent(StudentListModel model)
 {
     Students.RowEditOptions.EditRowId = null;
 }
 public void EditGrade(StudentListModel student, GradeModel grade)
 {
     //var student = Students.Items.Where(x => x.Grades.Items.Any(y => y.GradeId == grade.GradeId)).First();
     student.Grades.RowEditOptions.EditRowId = grade.GradeId;
 }