Exemple #1
0
 public ContributorQuery(IContributorRepository repository)
 {
     FieldAsync <ListContributorQueryModelType>(
         "search",
         arguments: new QueryArguments(
             new QueryArgument <NonNullGraphType <PagedRequestType> > {
         Name = "pagination"
     },
             new QueryArgument <NonNullGraphType <OrderedRequestType> > {
         Name = "ordering"
     },
             new QueryArgument <ContributorFilteredRequestType> {
         Name = "filter", DefaultValue = new ContributorFilter()
     }
             ),
         resolve: async context =>
     {
         var filtering            = context.GetArgument <ContributorFilter>("filter");
         var pagination           = context.GetArgument <PagedRequest>("pagination");
         var ordering             = context.GetArgument <OrderedRequest>("ordering");
         var(count, contributors) = await repository.SearchAsync(filtering, pagination, ordering);
         return(new ListResult <Contributor>
         {
             TotalCount = count,
             Items = contributors
         });
     }
         );
 }
        public Admin(IContributorRepository contributorRepository, IDemoModelFactory demoModelFactory, IDemoRepository demoRepository)
        {
            this.RequiresAuthentication();

            Delete["/contributor/{username}"] = parameters =>
            {
                contributorRepository.DeleteByUserName((string)parameters.username);
                demoRepository.DeleteByAuthor((string)parameters.username);

                return(Response.AsRedirect("~/contributors"));
            };

            Post["/contributors/refresh"] = parameters =>
            {
                var model =
                    contributorRepository.GetAll();

                demoRepository.DeleteAll();

                foreach (var contributorModel in model)
                {
                    var demos =
                        demoModelFactory.Retrieve(contributorModel.Username);

                    foreach (var demoModel in demos)
                    {
                        demoRepository.Persist(demoModel);
                    }
                }

                return(Response.AsRedirect("~/contributors"));
            };
        }
        public ContributorMutation(IContributorRepository repository)
        {
            FieldAsync <ContributorQueryType>(
                "addContributor",
                arguments: new QueryArguments(new QueryArgument <NonNullGraphType <ContributorCreateViewModel> >
            {
                Name = "contributor"
            }),
                resolve: async context =>
            {
                var contributor = context.GetArgument <Contributor>("contributor");
                return(await context.TryAsyncResolve(async _ => await repository.AddAsync(contributor)));
            }
                );

            FieldAsync <ContributorQueryType>(
                "removeContributor",
                arguments: new QueryArguments(new QueryArgument <NonNullGraphType <StringGraphType> >
            {
                Name = "id"
            }),
                resolve: async context =>
            {
                var id = context.GetArgument <string>("id");
                return(await context.TryAsyncResolve(
                           async _ => await repository.RemoveAsync(Guid.Parse(id))
                           ));
            }
                );
        }
        public Admin(IContributorRepository contributorRepository, IDemoModelFactory demoModelFactory, IDemoRepository demoRepository)
        {
            this.RequiresAuthentication();

            Delete["/contributor/{username}"] = parameters =>
            {
                contributorRepository.DeleteByUserName((string)parameters.username);
                demoRepository.DeleteByAuthor((string)parameters.username);

                return Response.AsRedirect("~/contributors");
            };

            Post["/contributors/refresh"] = parameters =>
            {
                var model =
                    contributorRepository.GetAll();

                foreach (var contributorModel in model)
                {
                    var demos =
                        demoModelFactory.Retrieve(contributorModel.Username);

                    foreach (var demoModel in demos)
                    {
                        demoRepository.Persist(demoModel);
                    }
                }

                return Response.AsRedirect("~/contributors");
            };
        }
Exemple #5
0
        public Api(IDemoRepository demoRepository, IContributorRepository contributorRepository)
            : base("/api")
        {
            Get["/contributors"] = parameters =>
            {
                return Negotiate.WithModel(contributorRepository.GetAll());
            };

            Get["/demos"] = parameters =>
            {
                return Negotiate.WithModel(demoRepository.GetAll());
            };
        }
Exemple #6
0
        public Api(IDemoRepository demoRepository, IContributorRepository contributorRepository)
            : base("/api")
        {
            Get["/contributors"] = parameters =>
            {
                return(Negotiate.WithModel(contributorRepository.GetAll()));
            };

            Get["/demos"] = parameters =>
            {
                return(Negotiate.WithModel(demoRepository.GetAll()));
            };
        }
 public ContributorService(ITaskRepository taskRepository, ICommonService commonService, IContributorRepository contributorRepository, TaskSkillModelFactory taskSkillModelFactory, TaskModelFactory taskModelFactory, ApprovedApplicantModelFactory approvedApplicantModelFactory, IUserRepository userRepository, IEmailTrackerService emailTrackerService)//, TaskModelFactory taskModelFactory, IRequestorRepository requestorRepository, ApplicantModelFactory applicantModelFactory, ApprovedContributorModelFactory approvedContributorModelFactory, ICommonService commonService, TaskApplicantModelFactory taskApplicantModelFactory, ApprovedApplicantModelFactory approvedApplicantModelFactory, IUserRepository userRepository)
 {
     _taskRepository                = taskRepository;
     _contributorRepository         = contributorRepository;
     _taskSkillModelFactory         = taskSkillModelFactory;
     _taskModelFactory              = taskModelFactory;
     _approvedApplicantModelFactory = approvedApplicantModelFactory;
     //_requestorRepository = requestorRepository;
     //_applicantModelFactory = applicantModelFactory;
     //_approvedContributorModelFactory = approvedContributorModelFactory;
     _commonService = commonService;
     //_taskApplicantModelFactory = taskApplicantModelFactory;
     _approvedApplicantModelFactory = approvedApplicantModelFactory;
     _userRepository      = userRepository;
     _emailTrackerService = emailTrackerService;
 }
Exemple #8
0
        public Contributors(IContributorRepository contributorRepository, IDemoModelFactory demoModelFactory, IContributorModelFactory factory)
            : base("/contributors")
        {
            Get["/"] = x => {
                return(View["contributors"]);
            };

            Post["/"] = x => {
                var contributor =
                    factory.Retrieve((string)Request.Form.username);

                if (contributorRepository != null)
                {
                    contributorRepository.Persist(contributor);
                }

                return(Response.AsRedirect("~/contributors"));
            };
        }
        public Contributors(IContributorRepository contributorRepository, IDemoModelFactory demoModelFactory, IGitHubUserFactory factory)
            : base("/contributors")
        {
            Get["/"] = x => {
                return View["contributors"];
            };

            Post["/"] = x => {
                var contributor =
                    factory.Retrieve((string)Request.Form.username);

                if (contributorRepository != null)
                {
                    contributorRepository.Persist(contributor);
                }

                return Response.AsRedirect("~/contributors");
            };
        }
 /// <summary>
 /// Dependency injection will automatically pass in the appropriate implementation
 /// mentioned in the SamChurchAPI.UnityConfig.RegisterComponents method
 /// </summary>
 /// <param name="contributorRepo"></param>
 public ContributorController(IContributorRepository contributorRepo)
 {
     contributorRepository = contributorRepo;
 }
Exemple #11
0
 public ContributorService(IContributorRepository contributorRepository)
 {
     _contributorRepository = contributorRepository;
 }
Exemple #12
0
 public void TestInitialize()
 {
     contributorRepository      = Substitute.For <IContributorRepository>();
     contributorFilterValidator = Substitute.For <IContributorFilterValidator>();
     sut = new NRCodeChallengeAppService(contributorRepository, contributorFilterValidator);
 }
 public ContributorService(IContributorRepository contributorRepository, IUnitOfWork unitOfWork)
 {
     this._contributorRepository = contributorRepository;
     this._unitOfWork            = unitOfWork;
 }
 public NRCodeChallengeAppService(IContributorRepository contributorRepository,
                                  IContributorFilterValidator contributorFilterValidator)
 {
     this.contributorRepository      = contributorRepository ?? throw new ArgumentNullException("contributorRepository");
     this.contributorFilterValidator = contributorFilterValidator ?? throw new ArgumentNullException("contributorFilterValidator");
 }
 public ContributorController(IContributorRepository repository, IDebtRepository debtRepository) : base(repository)
 {
     _repository     = repository;
     _debtRepository = debtRepository;
 }
 public ContributorService(IContributorRepository repository, IUnitOfWork unitOfWork)
 {
     _repository = repository;
     _unitOfWork = unitOfWork;
 }
Exemple #17
0
 public ContributorService(IContributorRepository contributorRepository, IMapper mapper)
 {
     _contributorRepository = contributorRepository;
     _mapper = mapper;
 }
        public void TestInitialize()
        {
            var iocContainer = IoC.IoCRegister.Register();

            sut = iocContainer.GetInstance <IContributorRepository>();
        }