public IActionResult About(string sortOrder, UserSearch userSearch, int?page) { CookieHelper cookieHelper = new CookieHelper(_httpContextAccessor, Request, Response); if (_signInManager.IsSignedIn(User)) { string userID = _userManager.GetUserId(User); cookieHelper.Set("UserID", userID, 1); HttpContext.Session.SetString("UserID", userID); ViewBag.userId = HttpContext.Session.GetString("UserID"); } if (!_signInManager.IsSignedIn(User)) { ViewBag.userId = ""; } if (User.Identity.Name != null) { var userName = User.Identity.Name; if (HttpContext.Session.GetString(userName) == null) { string name = userName; ViewBag.name = name; HttpContext.Session.SetString("username", name); } else { ViewBag.name = HttpContext.Session.GetString(userName); } } string sort = String.IsNullOrEmpty(sortOrder) ? "title_asc" : sortOrder; string search = String.IsNullOrEmpty(userSearch.searchString) ? "" : userSearch.searchString; ViewData["CurrentSort"] = sort; ViewData["CurrentFilter"] = search; int pageSize = 4; var query = new ShoeRepo(_storeDB).GetAll(sort, userSearch); return(View(PaginatedList <Shoe> .Create(query, page ?? 1, pageSize))); }
public IActionResult DeleteShoe(int id) { var query = new ShoeRepo(_context).DeleteShoe(id); return(View(query)); }
public IActionResult EditShoe(int shoeId, string shoeName, string shoeImage, decimal price) { var query = new ShoeRepo(_context).UpdateShoe(shoeId, shoeName, shoeImage, price); return(View(query)); }