Exemplo n.º 1
0
        public FeatureListVm GetFeatures(GetFeaturesQuery query)
        {
            if (query == null)
            {
                throw new ArgumentNullException(string.Format(MessagesModel.NullValueError, "query"));
            }

            GetFeaturesQueryResult results = this.queryDispatcher.Dispatch <GetFeaturesQuery, GetFeaturesQueryResult, Feature>(query);

            FeatureListVm vm = FeatureModelHelper.ResultToFeatureListVm(results, this.config);

            return(vm);
        }
Exemplo n.º 2
0
        private static FeatureListItemVm ResultToFeatureListItemVm(Feature result, IConfiguration config)
        {
            FeatureListItemVm feature = new FeatureListItemVm();

            feature.Id     = result.Id;
            feature.Name   = result.Name;
            feature.Ticket = result.Ticket;
            string ticketSystemBaseUrl = config.Get <string>("featurz.ticketsystemurl");

            feature.TicketLink = string.Format("{0}{1}", ticketSystemBaseUrl, result.Ticket);
            feature.Owner      = result.UserId;
            feature            = FeatureModelHelper.SetActive(feature, result);
            feature.DateAdded  = result.DateAdded;
            return(feature);
        }
Exemplo n.º 3
0
        //TODO: Decide what happens if we happen to have a duplicate key here.
        public FeatureVm EditFeature(FeatureVm vm)
        {
            if (vm == null)
            {
                throw new ArgumentNullException(string.Format(MessagesModel.NullValueError, "vm"));
            }

            EditFeatureCommand command = new EditFeatureCommand(vm.Id, vm.DateAdded, vm.Name, vm.UserId, vm.Ticket, vm.IsActive, vm.IsEnabled, vm.StrategyId);

            FeatureCommandResult result = this.commandDispatcher.Dispatch <EditFeatureCommand, FeatureCommandResult, Feature>(command);

            vm = FeatureModelHelper.CommandResultToFeatureVm(result);

            return(vm);
        }
Exemplo n.º 4
0
        //TODO: Change to only return users with an owner role.
        public ICollection <FeatureOwnerVm> GetFeatureOwners(GetFeatureOwnersQuery query)
        {
            if (query == null)
            {
                throw new ArgumentNullException(string.Format(MessagesModel.NullValueError, "query"));
            }

            ICollection <FeatureOwnerVm> owners  = new List <FeatureOwnerVm>();
            GetFeatureOwnersQueryResult  results = this.queryDispatcher.Dispatch <GetFeatureOwnersQuery, GetFeatureOwnersQueryResult, User>(query);

            foreach (var user in results.Owners)
            {
                FeatureOwnerVm owner = FeatureModelHelper.ResultToFeatureOwnerVm(user);
                owners.Add(owner);
            }

            return(owners);
        }