Exemplo n.º 1
0
        public ActionResult Publish(Guid id)
        {
            SysSetFormService service = new SysSetFormService();
            var model = service.Get(id);

            model.Status = Cupcake.Core.Domain.PublishStatus.Published;

            int intRv = service.Modify(model);

            if (intRv > 0)
            {
                MenuService mservice = new MenuService();

                Cupcake.Core.Domain.Menu menu = new Cupcake.Core.Domain.Menu();

                menu.Name       = model.FuntionName;
                menu.Sort       = 9;
                menu.Href       = "/ShowForm?t=" + model.TableName;
                menu.ParentId   = mservice.GetRootId();//new Guid("210D56FF-8EB0-E611-A9D4-00247EDEF854");
                menu.CreateDate = DateTime.Now;
                menu.UpdateDate = DateTime.Now;
                menu.IsDelete   = false;

                mservice.Add(menu);
            }

            return(Json(new { result = "success", msg = "发布成功!" }));
        }
Exemplo n.º 2
0
        public ActionResult NoPublish(Guid id)
        {
            SysSetFormService service = new SysSetFormService();
            var model = service.Get(id);

            model.Status = Cupcake.Core.Domain.PublishStatus.NotPublished;

            int intRv = service.Modify(model);

            if (intRv > 0)
            {
                MenuService mservice = new MenuService();

                Cupcake.Core.Domain.Menu menu = mservice.GetAll().Where(m => (m.Href != null && m.Href.Contains(model.TableName))).ToList().FirstOrDefault();

                mservice.Remove(menu);
            }

            return(Json(new { result = "success", msg = "撤回发布成功!" }));
        }