Beispiel #1
0
        public List <UsrMid> Get()
        {
            var           entities = _queryProcessor.Get();
            List <UsrMid> ju       = new List <UsrMid>();

            if (entities != null)
            {
                entities.ForEach(x => ju.Add(_autoMapper.Map <UsrMid>(x)));
                return(ju);
            }
            return(null);
        }
        public Cfg AddCfg(Cfg newCfg)
        {
            var cfgEntity = _autoMapper.Map <Data.Entities.Cfg>(newCfg);

            cfgEntity.Chg.Add(
                new Data.Entities.Chg()
            {
                ChgDate  = _dateTime.UtcNow,
                ChgState = _chgStateQueryProcessor.Get(10), // Cfg->Create
                ChgBy    = _usrQueryProcessor.Get(1)        // Default user
            }
                );

            _queryProcessor.AddCfg(cfgEntity);

            var cfg = _autoMapper.Map <Cfg>(cfgEntity);

            // TODO: Implement link service
            cfg.AddLink(new Link
            {
                Method = HttpMethod.Get.Method,
                Href   = Mss.Common.Constants.DefaultLegacyNamespace +
                         Mss.Common.Constants.CommonRoutingDefinitions.ApiSegmentName + '/' +
                         Mss.Common.Constants.CommonRoutingDefinitions.CurrentApiVersion + '/' +
                         Mss.Common.Constants.CommonControllerDefinitions.Cfg + '/' + cfg.Id,
                Rel = Constants.CommonLinkRelValues.Self
            });

            return(cfg);
        }
Beispiel #3
0
        public TeamWOChg AddTeam(TeamOnly newTeam)
        {
            var teamEntity = _autoMapper.Map <Data.Entities.Team>(newTeam);

            teamEntity.Chg.Add(
                new Data.Entities.Chg()
            {
                ChgDate  = _dateTime.UtcNow,
                ChgState = _chgStateQueryProcessor.Get(4), // Team -> Create
                ChgBy    = _usrQueryProcessor.Get(1)       // Default user
            }
                );

            _queryProcessor.AddTeam(teamEntity);

            var team = _autoMapper.Map <TeamWOChg>(teamEntity);

            // TODO: Implement link service
            team.AddLink(new Link
            {
                Method = HttpMethod.Get.Method,
                Href   = Mss.Common.Constants.DefaultLegacyNamespace +
                         Mss.Common.Constants.CommonRoutingDefinitions.ApiSegmentName + '/' +
                         Mss.Common.Constants.CommonRoutingDefinitions.CurrentApiVersion + '/' +
                         Mss.Common.Constants.CommonControllerDefinitions.Team + '/' + team.Id,
                Rel = Constants.CommonLinkRelValues.Self
            });

            return(team);
        }
        public TntWOChg AddTnt(TntOnly newTnt)
        {
            var tntEntity = _autoMapper.Map <Data.Entities.Tnt>(newTnt);

            tntEntity.Chg.Add(
                new Data.Entities.Chg()
            {
                ChgDate  = _dateTime.UtcNow,
                ChgState = _chgStateQueryProcessor.Get(7), // Tenant -> Create
                ChgBy    = _usrQueryProcessor.Get(1)       // Default user
            }
                );
            tntEntity.Cfg = _cfgQueryProcessor.Get(newTnt.Cfg);

            _queryProcessor.AddTnt(tntEntity);

            var tnt = _autoMapper.Map <TntWOChg>(tntEntity);

            // TODO: Implement link service
            tnt.AddLink(new Link
            {
                Method = HttpMethod.Get.Method,
                Href   = Mss.Common.Constants.DefaultLegacyNamespace +
                         Mss.Common.Constants.CommonRoutingDefinitions.ApiSegmentName + '/' +
                         Mss.Common.Constants.CommonRoutingDefinitions.CurrentApiVersion + '/' +
                         Mss.Common.Constants.CommonControllerDefinitions.Tnt + '/' + tnt.Id,
                Rel = Constants.CommonLinkRelValues.Self
            });

            return(tnt);
        }
Beispiel #5
0
        // ---------------- Service functions start --------------------
        private Tnt CutCategoriesAccordingToTheRights(Tnt tnt)
        {
            var u = _usrQueryProcessor.Get(_userSession.UserId);

            if (u != null)
            {
                // ...
                return(tnt);
            }
            return(null);
        }