public IndexAction() { _articleRepository = new ArticleRepository(); _nodeRepository = new NodeRepository(); _articleCategoryRepository = new ArticleCategoryRepository(); _nodeRecordRepository = new NodeRecordRepository(); }
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(); }
public ActionResult Remove(int id) { repository = new ArticleCategoryRepository(); var flag = repository.Delete(id); return(Json(flag)); }
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); }
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); }
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 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)); }
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); }
public ArticleCategoryAction() { _articleCategoryRepository = new ArticleCategoryRepository(); }
public NodeAction() { _articleCategoryRepository = new ArticleCategoryRepository(); _nodeRepository = new NodeRepository(); }
public ArticleCategoryService(ArticleCategoryRepository articleCategoryRepository) { _articleCategoryRepository = articleCategoryRepository; }
public ActionResult Remove(int id) { repository = new ArticleCategoryRepository(); var flag = repository.Delete(id); return Json(flag); }