public IActionResult Edit(int id) { if (HttpContext.Session.Get("Username") != null) { userID = Convert.ToInt32(HttpContext.Session.GetInt32("UserID")); try { if (collectionRepository.CheckMyList(id, userID)) { return(View(collectionRepository.GetList(id, userID))); } return(RedirectToAction("Index")); } catch (Exception e) { string message = e.Message; return(View("Error", "Database")); } } return(RedirectToAction("Login", "User")); }
public void TestCheckMyList() { Assert.AreEqual(true, collectionRepository.CheckMyList(1, 1)); Assert.AreEqual(false, collectionRepository.CheckMyList(1, 2)); }