Esempio n. 1
0
 public void FindStudentByParameters(StudentCreator expectedStudent)
 {
     int countOfObjects = new StudentSteps().GetListOfStudents()
         .Count(student => student.name.Equals(expectedStudent.name)
         && student.age.Equals(expectedStudent.age)
         && student.sex.Equals(expectedStudent.sex)
         && student.risk.Equals(expectedStudent.risk));
     Assert.AreEqual(1, countOfObjects,
         $"There should be only one student with the following properties. Actual count of such students is {countOfObjects}." +
         $"{PropertiesDescriber.GetObjectProperties(expectedStudent)}");
 }
Esempio n. 2
0
        private double CalculateDiscount(int studentId)
        {
            Student student     = new StudentSteps().GetStudentById(studentId);
            double  sexDiscount = student.sex ? 1 : 0.9;
            double  ageDiscount = student.age switch
            {
                long age when age < 21 => 0.9,
                long age when age < 18 => 0.8,
                    _ => 1
            };

            return(sexDiscount * ageDiscount);
        }
        // GET: Applicant
        public ActionResult Index()
        {
            StudentSteps data = new StudentSteps();

            data.studentStep1 = new StudentStep1();
            data.studentStep2 = new StudentStep2();
            data.studentStep3 = new StudentStep3();
            Models.DDLBinding objBoard = new Models.DDLBinding("BoardMaster", "", "", "");
            data.studentStep1.Boards = objBoard.GetData().Select(x => new ABoardMastrer()
            {
                Id   = Convert.ToInt32(x.ID),
                Name = x.Name
            });
            Models.DDLBinding objDistricts = new Models.DDLBinding("DistrictMaster", "", "", "");
            data.studentStep1.Districts = objDistricts.GetData().Select(x => new ApplicantPortal.Models.StudentDTO.ADistrictMaster()
            {
                Id   = Convert.ToInt32(x.ID),
                Name = x.Name
            });
            data.studentStep2.step2Districts = data.studentStep1.Districts;
            data.studentStep3.step3Districts = data.studentStep1.Districts;

            Models.DDLBinding objYears = new Models.DDLBinding("YearMaster", "", "", "");
            data.studentStep1.Years = objYears.GetData().Select(x => new ApplicantPortal.Models.StudentDTO.AYearMaster()
            {
                Id   = Convert.ToInt32(x.ID),
                Name = x.Name
            });
            Models.DDLBinding objColleges = new Models.DDLBinding("CollegeMaster", "", "", "");
            data.studentStep1.Colleges = objColleges.GetData().Select(x => new ApplicantPortal.Models.StudentDTO.ACollegeMaster()
            {
                Id   = Convert.ToInt32(x.ID),
                Name = x.Name
            });
            data.studentStep3.step3Colleges = data.studentStep1.Colleges;
            Models.DDLBinding objGender = new Models.DDLBinding("GenderMaster", "", "", "");
            data.studentStep2.Genders = objGender.GetData().Select(x => new ApplicantPortal.Models.StudentDTO.AGenderMaster()
            {
                Id   = Convert.ToInt32(x.ID),
                Name = x.Name
            });

            Models.DDLBinding objMotherTounge = new Models.DDLBinding("MotherToungeMaster", "", "", "");
            data.studentStep2.MotherTounges = objMotherTounge.GetData().Select(x => new ApplicantPortal.Models.StudentDTO.AMotherToungeMaster()
            {
                Id   = Convert.ToInt32(x.ID),
                Name = x.Name
            });

            Models.DDLBinding objNationality = new Models.DDLBinding("NationalityMaster", "", "", "");
            data.studentStep2.Nationalities = objNationality.GetData().Select(x => new ApplicantPortal.Models.StudentDTO.ANationalityMaster()
            {
                Id   = Convert.ToInt32(x.ID),
                Name = x.Name
            });

            Models.DDLBinding objReligion = new Models.DDLBinding("ReligionMaster", "", "", "");
            data.studentStep2.Religions = objReligion.GetData().Select(x => new ApplicantPortal.Models.StudentDTO.AReligionMaster()
            {
                Id   = Convert.ToInt32(x.ID),
                Name = x.Name
            });

            Models.DDLBinding objBloodGroup = new Models.DDLBinding("BloodGroupMaster", "", "", "");
            data.studentStep2.BloodGroups = objBloodGroup.GetData().Select(x => new ApplicantPortal.Models.StudentDTO.ABloodGroupMaster()
            {
                Id   = Convert.ToInt32(x.ID),
                Name = x.Name
            });

            Models.DDLBinding objStates = new Models.DDLBinding("StateMaster", "", "", "");
            data.studentStep2.States = objStates.GetData().Select(x => new ApplicantPortal.Models.StudentDTO.AStateMaster()
            {
                Id   = Convert.ToInt32(x.ID),
                Name = x.Name
            });
            Models.DDLBinding objBlocks = new Models.DDLBinding("BlockMaster", "", "", "");
            data.studentStep2.Blocks = objStates.GetData().Select(x => new ApplicantPortal.Models.StudentDTO.ABlockMaster()
            {
                Id   = Convert.ToInt32(x.ID),
                Name = x.Name
            });
            Models.DDLBinding objStreams = new Models.DDLBinding("StreamMaster", "", "", "");
            data.studentStep3.step3Streams = objStreams.GetData().Select(x => new ApplicantPortal.Models.StudentDTO.AStreamMaster()
            {
                Id   = Convert.ToInt32(x.ID),
                Name = x.Name
            });

            return(View(data));
        }