示例#1
0
 public ProfileViewModel(Profile profile)
 {
     this.Id = profile.Id;
     this.Name = profile.Name;
     this.Email = profile.Email;
     this.Country = profile.Country;
     this.PictureUrl = Path.Combine(Constants.UPLOADS_PATH, profile.PictureUrl);
 }
示例#2
0
        public static GeneralMembershipUser ProfileToUser(Profile profile)
        {
            GeneralMembershipUser user = new GeneralMembershipUser(profile.Email);
            user.Email = profile.Email;
            user.Name = profile.Name;

            return user;
        }
        private IEnumerable<CourseViewModel> GetCoursesByTeacher(Profile profile)
        {
            ICourseService service = CourseService.GetInstance<CourseRepository>();
            IEnumerable<CourseReport> res = service.GetCoursesByTeacherId(profile.Id);

            List<CourseViewModel> models = new List<CourseViewModel>();
            foreach (CourseReport course in res) {
                models.Add(new CourseViewModel(course));
            }
            return models;
        }
        private IEnumerable<ProfileViewModel> GetTeachersBySchool(Profile profile)
        {
            ISchoolTeacherService service = SchoolTeacherService.GetInstance<SchoolTeacherRepository>();
            IEnumerable<Profile> res = service.GetTeachersBySchoolId(profile.Id, "");

            List<ProfileViewModel> models = new List<ProfileViewModel>();
            foreach (Profile p in res) {
                models.Add(new ProfileViewModel(p));
            }
            return models;
        }
示例#5
0
 private ProfileViewModel GetProfileViewModel(Profile profile)
 {
     ProfileViewModel model = new ProfileViewModel(profile);
     return model;
 }
示例#6
0
        public void ProfileGenerator()
        {
            // id 1
            Profile schoolProfile = new Profile();
            schoolProfile.Name = "UMSA";
            schoolProfile.Email = "*****@*****.**";
            schoolProfile.Password = "******";
            schoolProfile.Country = "BO";
            schoolProfile.PictureUrl = "user.png";

            // id 2
            Profile studentProfile = new Profile();
            studentProfile.Name = "Juan Perez";
            studentProfile.Email = "*****@*****.**";
            studentProfile.Password = "******";
            studentProfile.Country = "BO";
            studentProfile.PictureUrl = "user.png";

            // id 3
            Profile teacherProfile = new Profile();
            teacherProfile.Name = "Simon Cruz";
            teacherProfile.Email = "*****@*****.**";
            teacherProfile.Password = "******";
            teacherProfile.Country = "BO";
            teacherProfile.PictureUrl = "user.png";

            // id 4
            Profile teacherProfile2 = new Profile();
            teacherProfile2.Name = "Rosa Flores";
            teacherProfile2.Email = "*****@*****.**";
            teacherProfile2.Password = "******";
            teacherProfile2.Country = "BO";
            teacherProfile2.PictureUrl = "user.png";

            // id 5
            Profile studentProfile2 = new Profile();
            studentProfile2.Name = "Pepe";
            studentProfile2.Email = "*****@*****.**";
            studentProfile2.Password = "******";
            studentProfile2.Country = "BO";
            studentProfile2.PictureUrl = "user.png";

            // id 6
            Profile schoolProfile2 = new Profile();
            schoolProfile2.Name = "UMSS";
            schoolProfile2.Email = "*****@*****.**";
            schoolProfile2.Password = "******";
            schoolProfile2.Country = "BO";
            schoolProfile2.PictureUrl = "user.png";

            // id 7
            Profile studentProfile3 = new Profile();
            studentProfile3.Name = "Maria";
            studentProfile3.Email = "*****@*****.**";
            studentProfile3.Password = "******";
            studentProfile3.Country = "BO";
            studentProfile3.PictureUrl = "user.png";

            context.Profiles.Add(schoolProfile); // 1
            context.Profiles.Add(teacherProfile); // 2
            context.Profiles.Add(studentProfile); // 3
            context.Profiles.Add(teacherProfile2); // 4
            context.Profiles.Add(studentProfile2); // 5
            context.Profiles.Add(schoolProfile2); // 6
            context.Profiles.Add(studentProfile3); // 7

            RoleProfileGenerator();
        }