Beispiel #1
0
        public IEnumerable <SolutionEx> ByOrganisation(string organisationId)
        {
            return(GetInternal(() =>
            {
                var solns = _solutionDatastore.ByOrganisation(organisationId);
                var retval = solns.Select(soln => BySolution(soln.Id));

                return retval;
            }));
        }
 public void MustBeCurrentVersion()
 {
     RuleFor(x => x)
     .Must(x =>
     {
         var solns = _solutionDatastore.ByOrganisation(x.OrganisationId);
         return(solns.Select(soln => soln.Id).Contains(x.Id));
     })
     .WithMessage("Can only change current version");
 }
Beispiel #3
0
        public IEnumerable <SolutionEx> ByOrganisation(string organisationId)
        {
            var solns = _solutionsDatastore.ByOrganisation(organisationId);

            var tasks = solns.Select(soln =>
            {
                return(Task <SolutionEx> .Factory.StartNew(() =>
                {
                    return BySolution(soln.Id.ToString());
                }));
            });

            Task.WaitAll(tasks.ToArray());

            var retval = tasks.Select(t => t.Result);

            return(retval);
        }
        public virtual IActionResult ApiSolutionsByOrganisationByOrganisationIdGet([FromRoute][Required] string organisationId, [FromQuery] int?pageIndex, [FromQuery] int?pageSize)
        {
            IEnumerable <Solution> solutions;
            int totalPages;

            try
            {
                solutions = _datastore.ByOrganisation(organisationId);
                solutions = _datastore.GetPagingValues(pageIndex, pageSize, solutions, out totalPages);
            }
            catch (Crm.CrmApiException ex)
            {
                return(StatusCode((int)ex.HttpStatus, ex.Message));
            }

            return(new ObjectResult(new PaginatedListSolutions()
            {
                Items = solutions.ToList(),
                TotalPages = totalPages,
                PageIndex = pageIndex ?? Paging.DefaultIndex,
                PageSize = pageSize ?? Paging.DefaultPageSize,
            }));
        }
Beispiel #5
0
 public IEnumerable <Solutions> ByOrganisation(string organisationId)
 {
     return(_filter.Filter(_datastore.ByOrganisation(organisationId)));
 }