示例#1
0
        private void AddManager(Managers entityToAdd)
        {
            IManagersRepository repo = new ManagersRepository(getEntities());

            Entities.Managers entityToAdd2 = Mapper.Map <Managers, Entities.Managers>(entityToAdd);
            repo.Add(entityToAdd2);
        }
示例#2
0
        public void RemoveManager(Managers entityToRemove)
        {
            IManagersRepository repo = new ManagersRepository(getEntities());

            Entities.Managers entityToRemove2 = Mapper.Map <Managers, Entities.Managers>(entityToRemove);
            repo.Remove(entityToRemove2);
        }
示例#3
0
        public int GetIdOfManager(Managers entityToGetId)
        {
            IManagersRepository repo = new ManagersRepository(getEntities());

            Entities.Managers entityToGetId2 = Mapper.Map <Managers, Entities.Managers>(entityToGetId);
            return(repo.GetManagerId(entityToGetId2));
        }
示例#4
0
        public Managers GetManagerById(int entityToGetById)
        {
            IManagersRepository repo = new ManagersRepository(getEntities());

            Entities.Managers returnedValue  = repo.GetById(entityToGetById);
            Managers          returnedValue2 = Mapper.Map <Entities.Managers, Managers>(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;
            }
        }