Пример #1
0
        public async Task <ActionResult> EvContentDelete(Guid id)
        {
            var evContentService = new EvContentService();
            await evContentService.RemoveEvContent(id);

            return(RedirectToAction(nameof(EvContentList)));
        }
Пример #2
0
        public async Task <ActionResult> EvContentDetails(Guid?id)
        {
            var evContentService = new EvContentService();

            if (id == null || !await evContentService.ExistsEvContent(id.Value))
            {
                return(RedirectToAction(nameof(EvContentList)));
            }
            return(View(await evContentService.GetOneEvContentById(id.Value)));
        }
Пример #3
0
 public ActionResult CreateEvContent(EvContentCreateViewModel model)
 {
     if (ModelState.IsValid)
     {
         IEvContentService evContentSvc = new EvContentService();
         evContentSvc.CreateEvContent(model.ContentCode, model.Content);
         return(RedirectToAction(nameof(EvContentList)));
     }
     ModelState.AddModelError("", @"您录入的信息有误");
     return(View());
 }
Пример #4
0
        public async Task <ActionResult> EvContentEdit(Guid id)
        {
            var evContentService = new EvContentService();
            var data             = await evContentService.GetOneEvContentById(id);

            return(View(new EvContentEditViewModel()
            {
                Id = data.Id,
                ContentCode = data.ContentCode,
                Content = data.Content
            }));
        }
Пример #5
0
        public async Task <ActionResult> EvContentEdit(Models.EvContentViewModels.EvContentEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                var evContentService = new EvContentService();
                await evContentService.EditEvContent(model.Id, model.ContentCode, model.Content);

                return(RedirectToAction(nameof(EvContentList)));
            }
            else
            {
                await new EvContentService().CreateEvContent(model.ContentCode, model.Content);
                return(View(model));
            }
        }
Пример #6
0
        public async Task <ActionResult> EvContentList(int pageIndex = 1, int pageSize = 5)
        {
            //总页码、当前页码、可显示总页码
            var evContentSvc = new EvContentService();
            //当前第n页数据
            var articles = await evContentSvc.GetAllEvContent(pageIndex, pageSize, false);

            //总个数
            var dataCount = await evContentSvc.GetDataCount();

            //绑定分页
            var list = new PagedList <EvContentDto>(articles, pageIndex, pageSize, dataCount);

            return(View(list));
        }