示例#1
0
 public IndexAction()
 {
     _articleRepository = new ArticleRepository();
     _nodeRepository = new NodeRepository();
     _articleCategoryRepository = new ArticleCategoryRepository();
     _nodeRecordRepository = new NodeRecordRepository();
 }
示例#2
0
        static void Main(string[] args)
        {
            var configBuilder = new ConfigurationBuilder()
                                .SetBasePath(Directory.GetCurrentDirectory())
                                .AddJsonFile("RabbitMQ.json", true, true)
                                .AddJsonFile("Application.json", true, true);
            var config = configBuilder.Build();

            var rabbitMqConfig    = config.GetSection("ZaabeeRabbitMQ").Get <MqConfig>();
            var applicationConfig = config.GetSection("Application");

            var categoryRepository = new ArticleCategoryRepository();

            Zaaby.ZaabyServer.GetInstance()
            .UseDDD()
            .UseZaabyServer <IApplicationService>()
            .UseEventBus()
            .AddSingleton <IConfig>(p =>
                                    new Config(applicationConfig))
            .AddSingleton <IZaabeeRabbitMqClient>(p =>
                                                  new ZaabeeRabbitMqClient(rabbitMqConfig, new Serializer()))
            .AddScoped <IIntegrationEventBus, ZaabyEventBus>()
            .AddScoped <ArticleCategoryDomainService>()
            .AddSingleton <IArticleRepository, ArticleRepository>()
            .AddSingleton <ArticleRepository>()
            .AddSingleton <IArticleQueryService, ArticleQueryService>()
            .AddSingleton <IArticleCategoryRepository>(e => categoryRepository)
            .AddSingleton <ICategoryQueryService>(e => categoryRepository)
            .UseUrls("http://*:5001")
            .Run();
        }
示例#3
0
        public ActionResult Remove(int id)
        {
            repository = new ArticleCategoryRepository();
            var flag = repository.Delete(id);

            return(Json(flag));
        }
示例#4
0
        public ActionResult List()
        {
            repository = new ArticleCategoryRepository();

            var query = repository.List();

            return(Json(query, JsonRequestBehavior.AllowGet));
        }
        public ActionResult List() 
        {
            repository = new ArticleCategoryRepository();

            var query = repository.List();

            return Json(query, JsonRequestBehavior.AllowGet);
        }
示例#6
0
        public ActionResult Add(ArticleCategory category)
        {
            if (ModelState.IsValid)
            {
                repository = new ArticleCategoryRepository();
                repository.Add(category);
                ViewBag.SectionId = 2;
                return(RedirectToAction("Index"));
            }
            ViewBag.SectionId = 3;

            return(View("Index", category));
        }
 public ActionResult Index(int id = 2)
 {
     ViewBag.SectionId = id;
     if (id == 3)
     {
         repository = new ArticleCategoryRepository();
         var list =repository.List().OrderBy(_ => _.Id).ToList();
         list.Insert(0, new ArticleCategory { Id = 0, CategoryName = "顶级分类" });
         ViewBag.Categories = new SelectList(list, "Id", "CategoryName");
     }
     
     return View();
 }
 public ActionResult Add(ArticleCategory category)
 {
     if (ModelState.IsValid) 
     {
         repository = new ArticleCategoryRepository();
         repository.Add(category);
         ViewBag.SectionId = 2;
         return RedirectToAction("Index");
     }
     ViewBag.SectionId = 3;
     
     return View("Index", category);
 }
 public ActionResult Edit(int id)
 {
     repository = new ArticleCategoryRepository();
     var category = repository.Find(id);
     if (category == null)
     {
         ViewBag.SectionId = 2;
         return View("Index");
     }
     var list = repository.List().Where(_ => _.Id != id).OrderBy(_ => _.Id).ToList();
     list.Insert(0, new ArticleCategory { Id = 0, CategoryName = "顶级分类" });
     ViewBag.Categories = new SelectList(list, "Id", "CategoryName");
     return View(category);
 }
示例#10
0
        public ActionResult Index(int id = 2)
        {
            ViewBag.SectionId = id;
            if (id == 3)
            {
                repository = new ArticleCategoryRepository();
                var list = repository.List().OrderBy(_ => _.Id).ToList();
                list.Insert(0, new ArticleCategory {
                    Id = 0, CategoryName = "顶级分类"
                });
                ViewBag.Categories = new SelectList(list, "Id", "CategoryName");
            }

            return(View());
        }
示例#11
0
        public ActionResult Edit(int id)
        {
            repository = new ArticleCategoryRepository();
            var category = repository.Find(id);

            if (category == null)
            {
                ViewBag.SectionId = 2;
                return(View("Index"));
            }
            var list = repository.List().Where(_ => _.Id != id).OrderBy(_ => _.Id).ToList();

            list.Insert(0, new ArticleCategory {
                Id = 0, CategoryName = "顶级分类"
            });
            ViewBag.Categories = new SelectList(list, "Id", "CategoryName");
            return(View(category));
        }
示例#12
0
 public ActionResult Edit(ArticleCategory category)
 {
     //TryValidateModel(category);
     if (ModelState.IsValid)
     {
         repository = new ArticleCategoryRepository();
         //var _ = repository.Find(category.Id);
         //_.Id = category.Id;
         //_.ParentId = category.ParentId;
         //_.LinkName = category.LinkName;
         //_.LinkUrl = category.LinkUrl;
         //_.SortOrder = category.SortOrder;
         //_.Status = category.Status;
         //repository.Update(_);
         repository.Update(category);
         ViewBag.SectionId = 2;
         return(RedirectToAction("Index"));
     }
     ViewBag.SectionId = 4;
     return(View("Index", category));
 }
 public ActionResult Edit(ArticleCategory category)
 {
     //TryValidateModel(category);
     if (ModelState.IsValid)
     {
         repository = new ArticleCategoryRepository();
         //var _ = repository.Find(category.Id);
         //_.Id = category.Id;
         //_.ParentId = category.ParentId;
         //_.LinkName = category.LinkName;
         //_.LinkUrl = category.LinkUrl;
         //_.SortOrder = category.SortOrder;
         //_.Status = category.Status;
         //repository.Update(_);
         repository.Update(category);
         ViewBag.SectionId = 2;
         return RedirectToAction("Index");
     }
     ViewBag.SectionId = 4;
     return View("Index", category);
 }
示例#14
0
 public ArticleCategoryAction()
 {
     _articleCategoryRepository = new ArticleCategoryRepository();
 }
示例#15
0
 public NodeAction()
 {
     _articleCategoryRepository = new ArticleCategoryRepository();
     _nodeRepository = new NodeRepository();
 }
示例#16
0
 public ArticleCategoryService(ArticleCategoryRepository articleCategoryRepository)
 {
     _articleCategoryRepository = articleCategoryRepository;
 }
 public ActionResult Remove(int id)
 {
     repository = new ArticleCategoryRepository();
     var flag = repository.Delete(id);
     return Json(flag);
 }