Exemple #1
0
 public TvShowsService(IDbRepository<TvShow> shows, IDbRepository<Actor> actors, IDbRepository<Tag> tags, IDbRepository<TvShowChannel> channels)
 {
     this.shows = shows;
     this.actors = actors;
     this.tags = tags;
     this.channels = channels;
 }
        public IQueryable<Category> GetCategoriesByPageAndSort(string sortType, string sortDirection, int page, int take)
        {
            IQueryable<Category> categories = null;
            switch (sortType)
            {
                case "Id":
                    categories = sortDirection == "ascending" ? this.categories.All().OrderBy(x => x.Id) : this.categories.All().OrderByDescending(x => x.Id);
                    break;
                case "Name":
                    categories = sortDirection == "ascending" ? this.categories.All().OrderBy(x => x.Name) : this.categories.All().OrderByDescending(x => x.Name);
                    break;
                case "CreatedOn":
                    categories = sortDirection == "ascending" ? this.categories.All().OrderBy(x => x.CreatedOn) : this.categories.All().OrderByDescending(x => x.CreatedOn);
                    break;
                case "ModifiedOn":
                    categories = sortDirection == "ascending" ? this.categories.All().OrderBy(x => x.ModifiedOn) : this.categories.All().OrderByDescending(x => x.ModifiedOn);
                    break;
            }

            categories = categories
                           .Skip((page - 1) * take)
                           .Take(take);

            return categories;
        }
 public PublicItemController(
     IDbRepository<Item> items,
     IDbRepository<Image> images)
 {
     this.dataItem = items;
     this.dataImage = images;
 }
        public int GenerateBattles(IDbRepository<Team> teamsRepository, IDbRepository<Battle> battlesRepository, int competitionId)
        {
            var teams = teamsRepository.All().Where(x => x.CompetitionId == competitionId).Select(x => new { x.Id }).ToList();
            var newBattles = 0;
            for (var i = 0; i < teams.Count; i++)
            {
                for (int j = i + 1; j < teams.Count; j++)
                {
                    var firstTeam = teams[i];
                    var secondTeam = teams[j];
                    if (battlesRepository.All().Any(
                        x =>
                        (x.FirstTeamId == firstTeam.Id && x.SecondTeamId == secondTeam.Id)
                        || (x.FirstTeamId == secondTeam.Id && x.FirstTeamId == firstTeam.Id)))
                    {
                        // Battle already exists
                        continue;
                    }

                    newBattles++;
                    battlesRepository.Add(new Battle { FirstTeamId = firstTeam.Id, SecondTeamId = secondTeam.Id });
                }
            }

            battlesRepository.Save();
            return newBattles;
        }
Exemple #5
0
 public StoryService(
     IDbRepository<Story> storyRepository,
     IDbRepository<Genre> genreRepository)
 {
     this.storyRepository = storyRepository;
     this.genreRepository = genreRepository;
 }
 public JoinOrganizationService(
     IDbRepository<JoinOrganizationRequest> joinOrganizationRequests,
     IDbRepository<User> users)
 {
     this.joinOrganizationRequests = joinOrganizationRequests;
     this.users = users;
 }
 public TripServices(IDbRepository<Trip> tripRepos, IDbRepository<PassengerTrip> passengerTripsRepos, IUserServices userServices, INotificationServices notificationServices)
 {
     this.tripRepos = tripRepos;
     this.passengerTripsRepos = passengerTripsRepos;
     this.userServices = userServices;
     this.notificationServices = notificationServices;
 }
 public SatisticsService(IDbRepository<Tutorial> tutorials, IDbRepository<Review> reviews, IDbRepository<Comment> comments, IDbRepository<Like> likes)
 {
     this.tutorials = tutorials;
     this.reviews = reviews;
     this.comments = comments;
     this.likes = likes;
 }
        public ProductsController(IDbRepository<Product> products, IDbRepository<Category> categories)
        {
            this.products = products;
            this.categories = categories;

            ViewData["ActiveMenuName"] = "Products";
        }
 public UserServices(IDbGenericRepository<User, string> userRepos, IDbRepository<UserComment> userCommentRepos)
 {
     this.userRepos = userRepos;
     this.dbContext = new TripDestinationDbContext();
     this.userManager = new UserManager<User>(new UserStore<User>(this.dbContext));
     this.userCommentRepos = userCommentRepos;
 }
 public JokesService(
     IDbRepository<Joke> jokes,
     IIdentifierProvider identifierProvider)
 {
     this.jokes = jokes;
     this.identifierProvider = identifierProvider;
 }
        public IQueryable<Post> GetPostsByPageAndSort(string sortType, string sortDirection, string search, int page, int take)
        {
            IQueryable<Post> posts = null;
            switch (sortType)
            {
                case "Date":
                    posts = sortDirection == "ascending" ? this.posts.All().OrderBy(x => x.CreatedOn) : this.posts.All().OrderByDescending(x => x.CreatedOn);
                    break;
                case "Title":
                    posts = sortDirection == "ascending" ? this.posts.All().OrderBy(x => x.Title) : this.posts.All().OrderByDescending(x => x.Title);
                    break;
                case "User":
                    posts = sortDirection == "ascending" ? this.posts.All().OrderBy(x => x.User.UserName) : this.posts.All().OrderByDescending(x => x.User.UserName);
                    break;
                case "Category":
                    posts = sortDirection == "ascending" ? this.posts.All().OrderBy(x => x.Category.Name) : this.posts.All().OrderByDescending(x => x.Category.Name);
                    break;
            }

            if (search == string.Empty || search == null)
            {
                posts = posts
                      .Skip((page - 1) * take)
                      .Take(take);
            }
            else
            {
                posts = posts
                    .Where(x => x.Title.Contains(search))
                    .Skip((page - 1) * take)
                    .Take(take);
            }

            return posts;
        }
Exemple #13
0
 public MoviesService(IDbRepository<Movie> movies, IDbRepository<Actor> actors, IDbRepository<Tag> tags, IDbRepository<Director> directors, IDbRepository<MovieStudio> studios)
 {
     this.movies = movies;
     this.actors = actors;
     this.directors = directors;
     this.tags = tags;
     this.studios = studios;
 }
 public AuctionController(IDbRepository<Auction> auctions,
     IDbRepository<Item> items,
     IAuctionService auctionService)
 {
     this.dataAuction = auctions;
     this.dataItem = items;
     this.auctionService = auctionService;
 }
 public WishListController(
       IProductService products,
       IDbRepository<Wishlist> wishLists,
       IService<Product> productsService)
 {
     this.productsService = productsService;
     this.products = products;
     this.wishLists = wishLists;
 }
 public ShoppingCartController(
       IProductService products,
       IDbRepository<ShoppingCart> shoppingCarts,
       IService<Product> productsService)
 {
     this.productsService = productsService;
     this.products = products;
     this.shoppingCarts = shoppingCarts;
 }
Exemple #17
0
 public RoomsService(
     IDbRepository<BookedRoom> booked,
     IDbRepository<Room> rooms,
     IDbRepository<Reservation> reservations)
 {
     this.bookedRooms = booked;
     this.rooms = rooms;
     this.reservations = reservations;
 }
        public AuditTrailQueryService(IDbRepository repository)
        {
            if (repository == null)
            {
                throw new ArgumentException("repository");
            }

            this.repository = repository;
        }
Exemple #19
0
 public StatisticsService(
     IDbRepository<Story> storyRepository,
     IDbRepository<Chapter> chapterRepository,
     IDbRepository<Genre> genreRepository)
 {
     this.storyRepository = storyRepository;
     this.chapterRepository = chapterRepository;
     this.genreRepository = genreRepository;
 }
 public OrganizationsService(
     IDbRepository<Organization> organizations,
     IDbRepository<User> users,
     IOrganizationImagesService organizationImages)
 {
     this.organizations = organizations;
     this.users = users;
     this.organizationImages = organizationImages;
 }
        public void RestartBattlesForTeam(IDbRepository<Battle> battlesRepository, int teamId)
        {
            var battlesForTeam = battlesRepository.All().Where(x => x.FirstTeamId == teamId || x.SecondTeamId == teamId);
            foreach (var battle in battlesForTeam)
            {
                battle.IsFinished = false;
            }

            battlesRepository.Save();
        }
        public ShopController(IDbRepository<Category> categories, IDbRepository<Product> products)
        {
            this.categories = categories;
            this.products = products;

            this.CalculateNumberOfProductsInCategories();

            ViewBag.Categories = this.categories.All().ToList();
            ViewBag.NumberOfProductsInCategories = this.numberOfProductsInCategories;
        }
 public CompetitionsController(
     IDbRepository<Competition> competitionsRepository,
     IDbRepository<Team> teamsRepository,
     IDbRepository<Battle> battlesRepository,
     IBattlesGenerator battlesGenerator)
 {
     this.competitionsRepository = competitionsRepository;
     this.teamsRepository = teamsRepository;
     this.battlesRepository = battlesRepository;
     this.battlesGenerator = battlesGenerator;
 }
 public DeveloperProfilesService(
     IDbRepository<DeveloperProfile, string> developerProfiles,
     IGithubService githubService,
     ISkillsService skills,
     IJobOffersService jobOffers,
     IUsersService users)
 {
     this.developerProfiles = developerProfiles;
     this.githubService = githubService;
     this.skills = skills;
     this.jobOffers = jobOffers;
     this.users = users;
 }
 public JobOffersService(
     IDbRepository<JobOffer, int> jobOffers,
     IDbRepository<Organization, int> organizations,
     IDbRepository<Skill, int> skills,
     IDbRepository<Candidacy, int> candidacies,
     IGenericRepository<User> users)
 {
     this.jobOffers = jobOffers;
     this.organizations = organizations;
     this.skills = skills;
     this.candidacies = candidacies;
     this.users = users;
 }
        public int RestartBattlesForCompetition(IDbRepository<Battle> battlesRepository, int competitionId)
        {
            var battlesForRestarting =
                battlesRepository.All()
                    .Where(
                        x => x.FirstTeam.CompetitionId == competitionId || x.SecondTeam.CompetitionId == competitionId)
                    .ToList();
            foreach (var battle in battlesForRestarting)
            {
                battle.IsFinished = false;
            }

            battlesRepository.Save();
            return battlesForRestarting.Count;
        }
 public StatisticsService(
     IDbRepository<HeadhunterProfile, string> headHunters,
     IDbRepository<DeveloperProfile, string> developers,
     IDbRepository<Organization, int> organizations,
     IDbRepository<JobOffer, int> jobOffers,
     IGenericRepository<User> users,
     IGenericRepository<IdentityRole> roles)
 {
     this.headHunters = headHunters;
     this.developers = developers;
     this.organizations = organizations;
     this.jobOffers = jobOffers;
     this.users = users;
     this.roles = roles;
 }
Exemple #28
0
        public PetSpecies Ensure(string name)
        {
            var species = this.species.All().FirstOrDefault(x => x.Name == name);

            if (species == null)
            {
                species = new PetSpecies
                {
                    Name = name
                };

                this.species.Add(species);
                this.species.Save();
            }

            return species;
        }
Exemple #29
0
 public PostsService(
     IDbRepository<Post> postsRepo,
     IDbRepository<Image> imagesRepo,
     IDbRepository<Comment> commentsRepo,
     IRegionsService regionsService, 
     IPostCategoriesService postCategoriesService, 
     IPetsService petsService, 
     IUsersService usersService)
 {
     this.postsRepo = postsRepo;
     this.imagesRepo = imagesRepo;
     this.commentsRepo = commentsRepo;
     this.regionsService = regionsService;
     this.postCategoriesService = postCategoriesService;
     this.petsService = petsService;
     this.usersService = usersService;
 }
 public StatisticsServices(
     IDbRepository<Trip> tripRepos,
     IDbRepository<UserComment> userCommentRepos,
     IDbRepository<TripComment> tripCommentRepos,
     IUserServices userServices,
     IDbRepository<View> viewRepos,
     IDbRepository<Rating> ratingRepos,
     IDbRepository<PassengerTrip> passengerTripRepos)
 {
     this.tripRepos = tripRepos;
     this.userCommentRepos = userCommentRepos;
     this.tripCommentRepos = tripCommentRepos;
     this.userServices = userServices;
     this.viewRepos = viewRepos;
     this.ratingRepos = ratingRepos;
     this.passengerTripRepos = passengerTripRepos;
 }
 public UsersGridController(IDbRepository <User> users)
 {
     this.users = users;
 }
 public UsersService(IDbRepository <ApplicationUser, string> users)
 {
     this.users = users;
 }
Exemple #33
0
 public BaseDataService(IDbRepository <T> dataSet)
 {
     this.Data = dataSet;
 }
Exemple #34
0
 public AircrewMemberReository(IDbRepository dbRepository)
     : base(dbRepository.GetDbInstance(), dbRepository.GetDbInstance().Set <AircrewMember>())
 {
 }
Exemple #35
0
 public ImagesService(IDbRepository <RecipeImage> recipeImages, IIdentifierProvider idProvider)
 {
     this.recipeImages = recipeImages;
     this.idProvider   = idProvider;
 }
Exemple #36
0
 public LikesController(IDbRepository <Like> likes)
 {
     this.likes = likes;
 }
 public UtilityManager(IDbRepository repo)
 {
     _db = repo;
 }
 public CategoryService(IDbRepository <Category> categories)
 {
     this.categories = categories;
 }
Exemple #39
0
 public GetAllUsersRequestHandler(IDbRepository dbRepository)
 {
     this.dbRepository = dbRepository;
 }
 public ImageService(IDbRepository <Image> images)
 {
     this.images = images;
 }
 public AnswerPredicate(IDbRepository <User> usersRepository)
 {
     _usersRepository = usersRepository;
 }
 public QuizzesRankingService(IDbRepository <Quiz> quizzes, IDbRepository <QuizCategory> categories)
 {
     this.quizzes    = quizzes;
     this.categories = categories;
 }
 public QuestionCommentService(IDbRepository <QuestionComment> questionComments)
 {
     this.questionComments = questionComments;
 }
Exemple #44
0
 public CommentsService(IDbRepository <Comment, int> comments)
 {
     this.comments = comments;
 }
 public LoginController()
 {
     this.phones = new DbRepository <Phone>(context);
 }
Exemple #46
0
 public BeerVotesService(IDbRepository <BeerVote> beerVotes, IIdentifierProvider identifierProvider)
 {
     this.beerVotes          = beerVotes;
     this.identifierProvider = identifierProvider;
 }
Exemple #47
0
 public CountryService(IDbRepository <Country> countries)
 {
     this.countries = countries;
 }
 public TweetService(IDbRepository <Tweet> tweets)
 {
     this.tweets = tweets;
 }
 /// <summary>
 /// Assign  IDbRepository
 /// </summary>
 /// <param name="repositry">Refrence of IDbRepository</param>
 public CustomerInvoiceComponent(IDbRepository repository)
 {
     _repository = repository;
 }
Exemple #50
0
 public CommentsService(IDbRepository <Comment> comments, IIdentifierProvider identifierProvider)
 {
     this.comments           = comments;
     this.identifierProvider = identifierProvider;
 }
 public ProjectCommentService(IDbRepository <ProjectComment> projectComments)
 {
     this.projectComments = projectComments;
 }
 public PostItRepository(IDbRepository dbRepository)
 {
     _dbRepository = dbRepository;
 }
Exemple #53
0
 public DenyPlayGamePredicate(IDbRepository <Models.User> usersRepository)
 {
     _usersRepository = usersRepository;
 }
 public CreateUserRequestHandler(IDbRepository dbRepository)
 {
     this.dbRepository = dbRepository;
 }
 public MetaSearchQueryParser(IDbRepository <Meta> metaRepository, JsonFileReader jsonReader)
 {
     _metaRepository = metaRepository;
     _jsonReader     = jsonReader;
 }
 public GraphicService(IDbRepository <Graphic> dbRepository, ITransactionManager transactionManager, IMapper mapper)
     : base(dbRepository, transactionManager, mapper)
 {
 }
Exemple #57
0
 public BuildingService(IDbRepository <ApartmentBuilding> buildings)
 {
     this.buildings = buildings;
 }
Exemple #58
0
 public SchedulesController(ISchedulesRepository schedulesRepository, IDbRepository dbRepository, IMapper mapper)
 {
     _schedulesRepository = schedulesRepository;
     _dbRepository        = dbRepository;
     _mapper = mapper;
 }
 public CurrentUser(IDbRepository <ApplicationUser> usersData)
 {
     this.usersData = usersData;
 }
 public JokesService(IDbRepository <Joke> jokes, IIdentifierProvider identifierProvider)
 {
     this.jokes = jokes;
     this.identifierProvider = identifierProvider;
 }