Exemplo n.º 1
0
        public IHttpActionResult GetAuthorizedDossiers(ODataQueryOptions <Dossier> options, ODataActionParameters parameter)
        {
            return(CommonHelpers.ActionHelper.TryCatchWithLoggerGeneric <IHttpActionResult>(() =>
            {
                DossierFinderModel finder = parameter[ODataConfig.ODATA_FINDER_PARAMETER] as DossierFinderModel;
                IDictionary <string, string> metadataValues = finder.MetadataValues.ToDictionary(d => d.KeyName, d => _metadataFilterFactory.CreateMetadataFilter(d).ToFilter());
                ICollection <DossierTableValuedModel> dossierResults = _unitOfWork.Repository <Dossier>().GetAuthorized(Username, Domain, finder.Skip, finder.Top, finder.Year, finder.Number, finder.Subject, finder.IdContainer, finder.StartDateFrom,
                                                                                                                        finder.StartDateTo, finder.EndDateFrom, finder.EndDateTo, finder.Note, finder.IdMetadataRepository, finder.MetadataValue, metadataValues, finder.IdCategory, finder.DossierType, finder.Status);
                ICollection <DossierModel> dossierModels = _mapperUnitOfwork.Repository <IDomainMapper <DossierTableValuedModel, DossierModel> >().MapCollection(dossierResults);

                return Ok(dossierModels);
            }, _logger, LogCategories));
        }
Exemplo n.º 2
0
        public IHttpActionResult AuthorizedFascicles(ODataQueryOptions <Fascicle> options, ODataActionParameters parameter)
        {
            return(CommonHelpers.ActionHelper.TryCatchWithLoggerGeneric(() =>
            {
                FascicleFinderModel finder = parameter[ODataConfig.ODATA_FINDER_PARAMETER] as FascicleFinderModel;

                DateTimeOffset?thresholdDate = CreateThresholdDate(finder.ViewOnlyClosable);
                IDictionary <string, string> metadataValues = finder.MetadataValues.ToDictionary(d => d.KeyName, d => _metadataFilterFactory.CreateMetadataFilter(d).ToFilter());
                ICollection <FascicleTableValuedModel> fasciclesModel = _unitOfWork.Repository <Fascicle>().GetAuthorized(Username, Domain, finder.Skip, finder.Top, finder.Year,
                                                                                                                          finder.StartDateFrom, finder.StartDateTo, finder.EndDateFrom, finder.EndDateTo, finder.FascicleStatus, finder.Manager, finder.Name, finder.Subject,
                                                                                                                          finder.ViewConfidential, finder.ViewAccessible, finder.Note, finder.Rack, finder.IdMetadataRepository, finder.MetadataValue, metadataValues,
                                                                                                                          finder.Classifications, finder.IncludeChildClassifications, finder.Roles, finder.Container, finder.ApplySecurity, _parameterEnvService.ForceDescendingOrderElements,
                                                                                                                          finder.ViewOnlyClosable, thresholdDate, finder.Title, finder.IsManager, finder.IsSecretary);
                ICollection <FascicleModel> fascicles = _mapperUnitOfwork.Repository <IDomainMapper <FascicleTableValuedModel, FascicleModel> >().MapCollection(fasciclesModel);
                return Ok(fascicles);
            }, _logger, LogCategories));
        }