コード例 #1
0
        public void RemoveStudent(Students entityToRemove)
        {
            IStudentsRepository repo = new StudentsRepository(getEntities());

            Entities.Students entityToRemove2 = Mapper.Map <Students, Entities.Students>(entityToRemove);
            repo.Remove(entityToRemove2);
        }
コード例 #2
0
        public int GetIdOfStudent(Students entityToGetId)
        {
            IStudentsRepository repo = new StudentsRepository(getEntities());

            Entities.Students entityToGetId2 = Mapper.Map <Students, Entities.Students>(entityToGetId);
            return(repo.GetStudentId(entityToGetId2));
        }
コード例 #3
0
        private void AddStudent(Students entityToAdd)
        {
            IStudentsRepository repo = new StudentsRepository(getEntities());

            Entities.Students entityToAdd2 = Mapper.Map <Students, Entities.Students>(entityToAdd);
            repo.Add(entityToAdd2);
        }
コード例 #4
0
        public Students GetStudentById(int entityToGetById)
        {
            IStudentsRepository repo = new StudentsRepository(getEntities());

            Entities.Students returnedValue  = repo.GetById(entityToGetById);
            Students          returnedValue2 = Mapper.Map <Entities.Students, Students>(returnedValue);

            return(returnedValue2);
        }
コード例 #5
0
        public void AddUser(Users entityToAdd)
        {
            IUsersRepository repo = new UsersRepository(getEntities());

            Entities.Users entityToAdd2 = Mapper.Map <Users, Entities.Users>(entityToAdd);
            repo.Add(entityToAdd2);
            switch (entityToAdd.UserType.ToUpper())
            {
            case "ADMINISTRATOR":
                IAdministratorsRepository adminRepo = new AdministratorsRepository(getEntities());
                Entities.Administrators   admin     = new Entities.Administrators()
                {
                    UserId = entityToAdd.Id
                };
                adminRepo.Add(admin);
                break;

            case "MANAGER":
                IManagersRepository managerRepo = new ManagersRepository(getEntities());
                Entities.Managers   manager     = new Entities.Managers()
                {
                    UserId = entityToAdd.Id
                };
                managerRepo.Add(manager);
                break;

            case "STUDENT":
                IStudentsRepository studentRepo = new StudentsRepository(getEntities());
                Entities.Students   student     = new Entities.Students()
                {
                    UserId = entityToAdd.Id
                };
                studentRepo.Add(student);
                break;

            case "TEACHER":
                ITeachersRepository teacherRepo = new TeachersRepository(getEntities());
                Entities.Teachers   teacher     = new Entities.Teachers()
                {
                    UserId = entityToAdd.Id
                };
                teacherRepo.Add(teacher);
                break;

            default:; break;
            }
        }