Пример #1
0
        public static void UpdatePlan(string id, Plan newPlan)
        {
            Plan plan = GetPlan(id);

            plan.Title        = newPlan.Title;
            plan.Description  = newPlan.Description;
            plan.Author       = newPlan.Author;
            plan.Variables    = newPlan.Variables;
            plan.Expressions  = newPlan.Expressions;
            plan.Styles       = newPlan.Styles;
            plan.PlanType     = newPlan.PlanType;
            plan.PlanCategory = newPlan.PlanCategory;
            plan.UserRole     = plan.UserRole;
            AppStore.PlanRepository.Save(id, new MemoryStream(System.Text.Encoding.UTF8.GetBytes(new JsonSerializer()
            {
                PrettifyJson = true
            }.SerializeToString(plan))));


            PlanLM planLM = PlanStorage.GetByID(id);

            if (planLM != null)
            {
                planLM.Title        = newPlan.Title;
                planLM.Description  = newPlan.Description;
                planLM.Author       = newPlan.Author;
                planLM.PlanType     = newPlan.PlanType;
                planLM.PlanCategory = newPlan.PlanCategory;
                planLM.UserRole     = planLM.UserRole;
                PlanStorage.Save(planLM);
            }
        }
Пример #2
0
        public static Plan GetPlan(string id)
        {
            var planlm = PlanStorage.GetByID(id);
            var plan   = AppStore.PlanRepository.Get(id);

            if (planlm != null)
            {
                plan.Description = planlm.Description;
            }
            return(plan);
        }