public ActionResult Index() { ViewBag.ActiveNoteList = "active"; if (HttpContext.Session["UserId"] == null) { return(RedirectToAction("Login", "Account")); } var userId = HttpContext.Session["UserId"].ToString(); NotesResultView resultView = new NotesResultView(); resultView.Notes = _notesRepo.GetAllNotes(Convert.ToInt32(userId), null, null); return(View(resultView)); }
public ActionResult Index(NotesResultView model) { ViewBag.ActiveNoteList = "active"; if (HttpContext.Session["UserId"] == null) { return(RedirectToAction("Login", "Account")); } var userId = HttpContext.Session["UserId"].ToString(); NotesResultView resultView = new NotesResultView(); resultView.Notes = _notesRepo.GetAllNotes(Convert.ToInt32(userId), model.FromDate, model.ToDate); if (model.FromDate != null) { resultView.FromDate = Convert.ToDateTime(model.FromDate); } if (model.ToDate != null) { resultView.ToDate = Convert.ToDateTime(model.ToDate); } return(View(resultView)); }