Exemplo n.º 1
0
        public HttpResponseMessage GetGenders()
        {
            var size = GenderRepository.GetAllGenders();
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, size);

            return(response);
        }
Exemplo n.º 2
0
        public HttpResponseMessage GetGenderByName(string name)
        {
            var size = GenderRepository.getGenderByName(name);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, size);

            return(response);
        }
Exemplo n.º 3
0
 public UnitOfWork(XdContext context)
 {
     _context            = context;
     AddressInformations = new AddressInformationRepository(_context);
     AppUsers            = new AppUserRepository(_context);
     AppUserRoles        = new AppUserRoleRepository(_context);
     Contacts            = new ContactRepository(_context);
     Credentials         = new CredentialsRepository(_context);
     DbTypes             = new DbTypeRepository(_context);
     Entities            = new EntityRepository(_context);
     EntityTypes         = new EntityTypeRepository(_context);
     Fields = new FieldRepository(_context);
     FieldRequirementLevels = new FieldRequirementLevelRepository(_context);
     FieldTypes             = new FieldTypeRepository(_context);
     Forms           = new FormRepository(_context);
     FormTypes       = new FormTypeRepository(_context);
     Genders         = new GenderRepository(_context);
     MaritalStatuses = new MaritalStatusRepository(_context);
     MenuItems       = new MenuItemRepository(_context);
     Roles           = new RoleRepository(_context);
     Tabs            = new TabRepository(_context);
     Titles          = new TitleRepository(_context);
     Views           = new ViewRepository(_context);
     ViewTypes       = new ViewTypeRepository(_context);
 }
Exemplo n.º 4
0
        public ActionResult Index()
        {
            if (string.IsNullOrEmpty(User.Identity.Name))
            {
                return(RedirectToAction("Login", "Account"));
            }

            using (UserRepository user = new UserRepository())
            {
                ViewBag.IsAdmin = user.IsAdmin(User.Identity.Name);
            }

            ViewBag.Title = "Customer List";

            CustomerViewModel model = new CustomerViewModel();

            using (GenderRepository gender = new GenderRepository())
                model.Genders = gender.GetAll();

            using (RegionRepository region = new RegionRepository())
                model.Regions = region.GetAll();

            using (CityRepository city = new CityRepository())
                model.Cities = city.GetAll();

            using (ClassificationRepository classification = new ClassificationRepository())
                model.Classifications = classification.GetAll();

            using (UserRepository user = new UserRepository())
                model.Sellers = user.GetAll();

            return(View(model));
        }
Exemplo n.º 5
0
 public List <Gender> GetGenderList()
 {
     return(GenderRepository.GetGenders().Select(m => new Gender()
     {
         ID = m.ID, Description = m.Description
     }).ToList());
 }
Exemplo n.º 6
0
        public HttpResponseMessage PostGender([FromBody] int id)
        {
            var size = GenderRepository.GetGender(id);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, size);

            return(response);
        }
Exemplo n.º 7
0
 public UnitOfWork(bbuContext context)
 {
     _context             = context;
     Addresses            = new AddressRepository(_context);
     AppUsers             = new AppUserRepository(_context);
     Banks                = new BankRepository(_context);
     BankAccounts         = new BankAccountRepository(_context);
     Cemeteries           = new CemeteryRepository(_context);
     Credentials          = new CredentialsRepository(_context);
     Deceaseds            = new DeceasedRepository(_context);
     Doctors              = new DoctorRepository(_context);
     Employees            = new EmployeeRepository(_context);
     Files                = new FileRepository(_context);
     Funerals             = new FuneralRepository(_context);
     FuneralDocuments     = new FuneralDocumentRepository(_context);
     Genders              = new GenderRepository(_context);
     HomeAffairsOffices   = new HomeAffairsOfficeRepository(_context);
     HomeAffairsOfficers  = new HomeAffairsOfficerRepository(_context);
     Hospitals            = new HospitalRepository(_context);
     Informants           = new InformantRepository(_context);
     Members              = new MemberRepository(_context);
     Months               = new MonthRepository(_context);
     Mortuaries           = new MortuaryRepository(_context);
     NextOfKins           = new NextOfKinRepository(_context);
     NumberConfigurations = new NumberConfigurationRepository(_context);
     Payments             = new PaymentRepository(_context);
     PaymentPeriods       = new PaymentPeriodRepository(_context);
     People               = new PersonRepository(_context);
     PurchaseItems        = new PurchaseItemRepository(_context);
     Settings             = new SettingRepository(_context);
     States               = new StateRepository(_context);
     Suppliers            = new SupplierRepository(_context);
     Tasks                = new TaskRepository(_context);
     Years                = new YearRepository(_context);
 }
Exemplo n.º 8
0
        private readonly IGenderService _service; //para o teste funcionar ele precisa do servico, por isso private readoly IGenderService
        public GenderTeste()
        {
            RegisterMappers.Register();

            var repository = new GenderRepository();

            _service = new GenderService(repository); //precia de um repositorio que atenda o genderService
        }
Exemplo n.º 9
0
 public UnitOfWork(IECContext context)
 {
     _context      = (IECContext)context;
     Cities        = new CityRepository(_context);
     Countries     = new CountryRepository(_context);
     Genders       = new GenderRepository(_context);
     IdentityCards = new IdentityCardRepository(_context);
 }
Exemplo n.º 10
0
 public ExcelHelper(ks54AISContext context = null)
 {
     if (context != null)
     {
         groupRepository  = new GroupRepository(context);
         genderRepository = new GenderRepository(context);
     }
 }
Exemplo n.º 11
0
        public GenderTest()
        {
            RegisterMappers.Register();

            var repository = new GenderRepository();

            _service = new GenderService(repository);
        }
Exemplo n.º 12
0
 public UnitofWork()
 {
     _context                  = new WebShopModel.ModelShop();
     ProductRepository         = new ProductRepository(_context);
     ProductCategoryRepository = new ProductCategoryRepository(_context);
     GenderRepository          = new GenderRepository(_context);
     CategoryRepository        = new CategoryRepository(_context);
 }
Exemplo n.º 13
0
 public UnitOfWork(HospitalDbContext context)
 {
     _context                 = context;
     Patient                  = new PatientRepository(context);
     Gender                   = new GenderRepository(context);
     doctorRepository         = new DoctorRepository(context);
     specializationRepository = new SpecializationRepository(context);
     appoinmentRepository     = new AppoinmentRepository(context);
 }
Exemplo n.º 14
0
 public LibraryService()
 {
     this.readerRepository = new ReaderRepository();
     this.reviewRepository = new ReviewRepository();
     this.bookRepository   = new BookRepository();
     this.autorRepository  = new AutorRepository();
     this.genderRepository = new GenderRepository();
     this.loanRepository   = new LoanRepository();
 }
Exemplo n.º 15
0
 public SharePostUnitOfWork(DataContext context)
 {
     this.Context = context;
     SharePosts   = new SharePostRepository(Context);
     Addresses    = new AddressRepository(Context);
     ShareTypes   = new ShareTypeRepository(Context);
     Genders      = new GenderRepository(Context);
     Places       = new PlaceRepository(Context);
     Suburbs      = new SuburbRepository(Context);
     Pictures     = new PictureRepository(Context);
 }
Exemplo n.º 16
0
 public StudentController()
 {
     _repository                        = new PeriodGradeStudentRepository();
     _periodRepository                  = new PeriodRepository();
     _gradeRepository                   = new GradeRepository();
     _genderRepository                  = new GenderRepository();
     _studentRepository                 = new StudentRepository();
     _transactionTypeRepository         = new TransactionTypeRepository();
     _periodGradeStudentRepository      = new PeriodGradeStudentRepository();
     _studentPayConfigurationRepository = new StudentPayConfigurationRepository();
     _cityRepository                    = new CityRepository();
 }
Exemplo n.º 17
0
        public void GetAll_AllGendersReturned_CountEqualsActual()
        {
            const int expectedCount = 3;
            int       actualCount;

            using (var genderRepo = new GenderRepository(DataContextCreator.CreateTestContext()))
            {
                actualCount = genderRepo.GetAll().Count();
            }

            Assert.AreEqual(expectedCount, actualCount);
        }
Exemplo n.º 18
0
        public void GetAll_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new GenderRepository(context);

            // Act
            IEnumerable <gender> result = repository.GetAll();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(context.gender.Count(), result.Count());
        }
Exemplo n.º 19
0
        public void GetById_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new GenderRepository(context);

            // Act
            gender result = repository.GetById(4);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(4, result.id);
        }
Exemplo n.º 20
0
        public void GetById_Test()
        {
            // Arrange
            TestKolgraphEntities context = new TestKolgraphEntities();
            var repository = new GenderRepository(context);
            var service    = new GenderService(repository);

            // Act
            GenderModel result = service.GetById(4);

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(4, result.Id);
        }
Exemplo n.º 21
0
 public UnitOfWork(SalaryAppContext context)
 {
     _context      = context;
     Banks         = new BankRepository(_context);
     Cities        = new CityRepository(_context);
     Countries     = new CountryRepository(_context);
     Companies     = new CompanyRepository(_context);
     Genders       = new GenderRepository(_context);
     Employees     = new EmployeeRepository(_context);
     Workplaces    = new WorkplaceRepository(_context);
     Salaries      = new SalaryRepository(_context);
     SalaryDetails = new SalaryDitailsRepository(_context);
     Attendances   = new AttendanceRepository(_context);
 }
Exemplo n.º 22
0
        public void DeleteById_WasDeleted_ActualDataIsNull()
        {
            var    typeIdToDelete = AddandGetTestGender().Id;
            Gender actualGender;

            using (var genderRepo = new GenderRepository(DataContextCreator.CreateTestContext()))
            {
                genderRepo.Delete(typeIdToDelete);
                genderRepo.SaveChanges();
                actualGender = genderRepo.GetById(typeIdToDelete);
            }

            Assert.IsNull(actualGender);
        }
Exemplo n.º 23
0
 public ClientInformationsController()
 {
     _regionRepository          = new RegionRepository();
     _clientInformation         = new ClientInformation();
     _countryRepository         = new CountryRepository();
     _businessTypeRepository    = new BusinessTypeRepository();
     _businessStatusRepository  = new BusinessStatusRepository();
     _counsellingTypeRepository = new CounsellingTypeRepository();
     _exportRepository          = new ExportRepository();
     _genderRepository          = new GenderRepository();
     _raceTypeRepository        = new RaceRepository();
     _sbaClientTypeRepository   = new SBAClientTypeRepository();
     _veteranTypeRepository     = new VeteranRepository();
 }
Exemplo n.º 24
0
        private Gender AddandGetTestGender()
        {
            var genderType = new Gender
            {
                Description = "TestGender"
            };

            using (var genderRepo = new GenderRepository(DataContextCreator.CreateTestContext()))
            {
                genderRepo.Add(genderType);
                genderRepo.SaveChanges();
            }

            return(genderType);
        }
Exemplo n.º 25
0
        public void GetById_CorrectDataGot_EqualsExpectedData()
        {
            var expectedGender = new Gender
            {
                Id          = 1,
                Description = "Male"
            };
            Gender actualGender;

            using (var genderRepo = new GenderRepository(DataContextCreator.CreateTestContext()))
            {
                actualGender = genderRepo.GetById(expectedGender.Id);
            }

            AssertGendersEqual(expectedGender, actualGender);
        }
Exemplo n.º 26
0
        public UnitOfWork(ZeusDbContext context)
        {
            _context = context;

            CourseRepository        = new CourseRepository(_context);
            GenderRepository        = new GenderRepository(_context);
            StatusRepository        = new StatusRepository(_context);
            UserTypeRepository      = new UserTypeRepository(_context);
            SubjectRepository       = new SubjectRepository(_context);
            UserRepository          = new UserRepository(_context);
            CareerRepository        = new CareerRepository(_context);
            CareerSubjectRepository = new CareerSubjectRepository(_context);
            PeriodRepository        = new PeriodRepository(_context);
            SectionRepository       = new SectionRepository(_context);
            SubscriptionRepository  = new SubscriptionRepository(_context);
        }
Exemplo n.º 27
0
        public void LoadDropDownFiltersBag()
        {
            IGenderRepository genderRepository = new GenderRepository(_connectionString);
            var genderApp = new GenderApplication(genderRepository);

            ViewBag.Genders = genderApp.GetAll().Select(g => new SelectListItem()
            {
                Text  = g.Name,
                Value = g.Id.ToString()
            }).ToList();

            ICityRepository cityRepository = new CityRepository(_connectionString);
            var             cityApp        = new CityApplication(cityRepository);

            ViewBag.Cities = cityApp.GetAll().Select(g => new SelectListItem()
            {
                Text  = g.Name,
                Value = g.Id.ToString()
            }).ToList();

            IRegionRepository regionRepository = new RegionRepository(_connectionString);
            var regionApp = new RegionApplication(regionRepository);

            ViewBag.Regions = regionApp.GetAll().Select(g => new SelectListItem()
            {
                Text  = g.Name,
                Value = g.Id.ToString()
            }).ToList();

            IClassificationRepository classificationRepository = new ClassificationRepository(_connectionString);
            var classificationApp = new ClassificationApplication(classificationRepository);

            ViewBag.Classifications = classificationApp.GetAll().Select(g => new SelectListItem()
            {
                Text  = g.Name,
                Value = g.Id.ToString()
            }).ToList();

            IUserSysRepository userRepository = new UserSysRepository(_connectionString);
            var userApp = new UserApplication(userRepository);

            ViewBag.Sellers = userApp.GetAll().Select(g => new SelectListItem()
            {
                Text  = g.Login,
                Value = g.Id.ToString()
            }).ToList();
        }
Exemplo n.º 28
0
        public void Add_WasGenderAdded_ActualEqualsExpectedData()
        {
            var expectedGender = new Gender
            {
                Description = "Test Gender"
            };
            Gender actualGender;

            using (var genderRepo = new GenderRepository(DataContextCreator.CreateTestContext()))
            {
                genderRepo.Add(expectedGender);
                genderRepo.SaveChanges();
                actualGender = genderRepo.GetById(expectedGender.Id);
            }

            AssertGendersEqual(expectedGender, actualGender);
        }
 public UnitOfWork()
 {
     _context                 = new IndicoContext();
     CompanyRepository        = new CompanyRepository(_context);
     UserStatusRepository     = new UserStatusRepository(_context);
     MenuItemRepository       = new MenuItemRepository(_context);
     UserRepository           = new UserRepository(_context);
     RoleRepository           = new RoleRepository(_context);
     OrderRepository          = new OrderRepository(_context);
     OrderDetailRepository    = new OrderDetailRepository(_context);
     AgeGroupRepository       = new AgeGroupRepository(_context);
     ColourProfileRepository  = new ColourProfileRepository(_context);
     GenderRepository         = new GenderRepository(_context);
     PrinterRepository        = new PrinterRepository(_context);
     PrinterTypeRepository    = new PrinterTypeRepository(_context);
     ProductionLineRepository = new ProductionLineRepository(_context);
 }
Exemplo n.º 30
0
        private async Task ValidatePlayerToGender(int id, ParticipantViewModel participant)
        {
            var gender = await GenderRepository.FindAsync(id);

            if (gender.Name == "Female")
            {
                if (!(participant.Gender == "F"))
                {
                    ModelState.AddModelError("Gender", "Your team is registered for a female league. In order to play co-ed, you must register the team as a co-ed team.");
                }
            }
            if (gender.Name == "Male")
            {
                if (!(participant.Gender == "M"))
                {
                    ModelState.AddModelError("Gender", "Your team is registered for a male league. In order to play co-ed, you must register the team as a co-ed team.");
                }
            }
        }
Exemplo n.º 31
0
        private void PopulateToolsetViewModel()
        {
            ClearViewModelPopulation();

            using (GameModuleRepository repo = new GameModuleRepository())
            {
                ViewModel.ActiveModule = repo.GetModule();
            }

            using (ContentPackageResourceRepository repo = new ContentPackageResourceRepository())
            {
                ViewModel.TilesetSpriteSheetsList = repo.GetAllUIObjects(ContentPackageResourceTypeEnum.Tileset, false);
            }

            using (ItemRepository repo = new ItemRepository())
            {
                ViewModel.ItemList = repo.GetAllUIObjects();
            }

            using (ScriptRepository repo = new ScriptRepository())
            {
                ViewModel.ScriptList = repo.GetAllUIObjects();
            }

            using (GenderRepository repo = new GenderRepository())
            {
                ViewModel.GenderList = repo.GetAllUIObjects();
            }

            using (ConversationRepository repo = new ConversationRepository())
            {
                ViewModel.ConversationList = repo.GetAllUIObjects();
            }

            using (RaceRepository repo = new RaceRepository())
            {
                ViewModel.RaceList = repo.GetAllUIObjects();
            }

            using (FactionRepository repo = new FactionRepository())
            {
                ViewModel.FactionList = repo.GetAllUIObjects();
            }

            using (TilesetRepository repo = new TilesetRepository())
            {
                ViewModel.TilesetList = repo.GetAllUIObjects();
            }

            using (AbilityRepository repo = new AbilityRepository())
            {
                ViewModel.AbilityList = repo.GetAll();
            }

            using (SkillRepository repo = new SkillRepository())
            {
                ViewModel.SkillList = repo.GetAll();
            }

            using (LevelRequirementRepository repo = new LevelRequirementRepository())
            {
                ViewModel.LevelRequirementList = repo.GetAll();
            }
        }