Esempio n. 1
0
        public CourseInfoDto CourseInfo(string email)
        {
            var Appliedcourses = (from s in context.MentorSkills
                                  join t in context.Technologies on s.TechId equals t.Id
                                  join c in context.Courses on s.Id equals c.MentorSkillId
                                  where (c.StudentEmail == email && c.IsRequested == true)
                                  select c).ToList().Count;
            var Registeredcourses = (from s in context.MentorSkills
                                     join t in context.Technologies on s.TechId equals t.Id
                                     join c in context.Courses on s.Id equals c.MentorSkillId
                                     where (c.StudentEmail == email && c.IsRegistered == true)
                                     select c).ToList().Count;
            var Confirmedcourses = (from s in context.MentorSkills
                                    join t in context.Technologies on s.TechId equals t.Id
                                    join c in context.Courses on s.Id equals c.MentorSkillId
                                    where (c.StudentEmail == email && c.IsConfirmed == true)
                                    select c).ToList().Count;
            var Completedcourses = (from s in context.MentorSkills
                                    join t in context.Technologies on s.TechId equals t.Id
                                    join c in context.Courses on s.Id equals c.MentorSkillId
                                    where (c.StudentEmail == email && c.IsCompleted == true)
                                    select c).ToList().Count;
            var result = new CourseInfoDto
            {
                AppliedCourses    = Appliedcourses,
                RegisteredCourses = Registeredcourses,
                ConfirmedCourses  = Confirmedcourses,
                CompletedCourses  = Completedcourses
            };

            return(result);
        }
Esempio n. 2
0
        static Dtos()
        {
            SettingsDto = new SettingsDto
            {
                CourseImageUrl = "https://images.com"
            };

            CourseDto = new CourseDto
            {
                Id        = Faker.RandomNumber.Next(1, 9999),
                Name      = Faker.Company.Name(),
                ImagePath = Faker.Internet.DomainName()
            };

            CourseInfoDto = new CourseInfoDto
            {
                AddressInfo = new CourseInfoDto.CourseAddressDto
                {
                    Street = Faker.Address.StreetAddress(),
                    City   = Faker.Address.City(),
                    State  = Faker.Address.UsStateAbbr(),
                    Zip    = Faker.Address.ZipCode()
                },
                ContactInfo = new CourseInfoDto.CourseContactInfoDto
                {
                    Website      = Faker.Internet.DomainName(),
                    ContactEmail = Faker.Internet.Email(),
                    ContactPhone = Faker.Phone.Number()
                },
                TextContent = new CourseInfoDto.CourseTextDto
                {
                    About = Faker.Company.BS()
                }
            };

            HoleDtoList = new List <HoleDto>
            {
                new HoleDto
                {
                    Id       = Faker.RandomNumber.Next(1, 9999),
                    CourseId = CourseDto.Id.Value,
                    Par      = Faker.RandomNumber.Next(1, 5),
                    Number   = 1
                },
                new HoleDto
                {
                    Id       = 51,
                    CourseId = CourseDto.Id.Value,
                    Par      = Faker.RandomNumber.Next(1, 5),
                    Number   = 2
                },
            };
        }