Example #1
0
        public ActionResult Index()
        {
            DiaryIndexView vm = new DiaryIndexView();

            vm.Diaries = _DiaryService.FindByUserId(null, LoginState.LoginUserId, 1, _PageSize);

            return(View(vm));
        }
Example #2
0
        public ActionResult CreatePost(DiaryIndexView vm)
        {
            int cnt = 0;

            if (ModelState.IsValid)
            {
                vm.AddDiary.UserId = LoginState.LoginUserId;
                cnt = _DiaryService.Create(vm.AddDiary);

                if (cnt > 0)
                {
                    TempData["Message"] = string.Format("{0},{1}", "success", "新增成功");
                }
                else
                {
                    TempData["Message"] = string.Format("{0},{1}", "warning", "新增失敗");
                }
            }

            vm.Diaries = _DiaryService.FindByUserId(null, LoginState.LoginUserId, 1, _PageSize);

            return(RedirectToAction("Index"));
        }
Example #3
0
        public ActionResult IndexPost(DiaryIndexView vm)
        {
            vm.Diaries = _DiaryService.FindByUserId(vm.SearchWorkDate, LoginState.LoginUserId, vm.CurrentPage, _PageSize);

            return(View("Index", vm));
        }