public async Task <IActionResult> Index() { if (!await _sessionService.IsAuthentificateAsync()) { return(RedirectToAction("Login", "Library")); } return(View(_bookService.GetAll(_sessionService.GetCurrentLibraryId()))); }
public async Task<IActionResult> Logout() { if (!await _sessionService.IsAuthentificateAsync()) { return RedirectToAction("Login"); } Response.Cookies.Append(SesssionKeys.LibrarySessionKey, "", new CookieOptions { Path = "/", Expires = DateTime.Now.AddDays(-1) }); return RedirectToAction("Login", "Library"); }
/// <summary> /// /// </summary> /// <returns></returns> public async Task <IActionResult> Index() { if (!await _sessionService.IsAuthentificateAsync()) { return(RedirectToAction("Login", "Library")); } var users = _db.LibraryUsers .Include(x => x.Library) .Where(x => x.LibraryId == _sessionService.GetCurrentLibraryId()) .Select(x => _mapper.Map <LibraryUserViewModel>(x)) .ToList(); return(View(users)); }