public ActionResult Branchlist() { if (Session["username"] == null) { return(RedirectToAction("HomePage", "Home")); } int id = Convert.ToInt32(Request.QueryString["delete"]); if (id != 0) { Branch branch = branchManager.GetById(id); branchManager.Delete(branch); return(RedirectToAction("Branchlist")); } return(View()); }
public void Delete() { UnityResolver.Register(); IBranchManager BranchManager = UnityResolver.Resolve <IBranchManager>(); Branch branch = BranchManager.Find(B => B.BranchId == 115); bool ans = BranchManager.Delete(branch); BranchManager.Save(); bool expected = true; bool actual = ans; Assert.AreEqual(expected, actual); }