public ActionResult Index() { DiaryIndexView vm = new DiaryIndexView(); vm.Diaries = _DiaryService.FindByUserId(null, LoginState.LoginUserId, 1, _PageSize); return(View(vm)); }
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")); }
public ActionResult IndexPost(DiaryIndexView vm) { vm.Diaries = _DiaryService.FindByUserId(vm.SearchWorkDate, LoginState.LoginUserId, vm.CurrentPage, _PageSize); return(View("Index", vm)); }