Пример #1
0
        public IActionResult GarderActivities([FromBody] StepFlowModel flowModel)
        {
            var model = MappingData(flowModel);
            var page  = HttpContext.Session.Get <string>("StepWorkFlowsPage");

            if (page == "Create")
            {
                var lists = HttpContext.Session.Get <List <StepFlowModel> >("StepWorkFlow") ?? new List <StepFlowModel>();
                var nbre  = lists.Count + 1;
                model.id = nbre + "";
                lists.Add(model);
                HttpContext.Session.Set <List <StepFlowModel> >("StepWorkFlow", lists);
                // Requires you add the Set and Get extension method mentioned in the topic.
                return(Ok(lists));
            }
            else
            {
                SchemeStepFlowModel schemeStepFlow = new SchemeStepFlowModel()
                {
                    Activity           = model.activity,
                    Gestionnaire       = model.cible,
                    Service            = model.service,
                    Occurence          = 1,
                    Description        = model.Description,
                    DetailsControleurs = model.DetailsControleurs
                };
                var lists = HttpContext.Session.Get <List <SchemeStepFlowModel> >("SchemeStepFlowModel") ?? new List <SchemeStepFlowModel>();
                var nbre  = lists.Count + 1;
                schemeStepFlow.Ordre = nbre + "";
                lists.Add(schemeStepFlow);
                HttpContext.Session.Set <List <SchemeStepFlowModel> >("SchemeStepFlowModel", lists);
                // Requires you add the Set and Get extension method mentioned in the topic.
                return(Ok(lists));
            }
        }
Пример #2
0
 public StepFlowModel MappingData(StepFlowModel flowModel)
 {
     return(new StepFlowModel()
     {
         activity = flowModel.activity,
         cible = flowModel.cible,
         service = flowModel.service,
         id = flowModel.id,
         Description = controleurs.FirstOrDefault(c => c.Controller == flowModel.cible && c.Action == flowModel.service).Description,
         DetailsControleurs = controleurs.FirstOrDefault(c => c.Controller == flowModel.cible && c.Action == flowModel.service).DetailsControleurs
     });
 }