public void ReplyDeleteTest(int id, string content, bool pinned, string date, int postid, int accountid, string username) { DateTime DateParsed = DateTime.Parse(date); bool result = container.Delete(new Reply(id, content, pinned, DateParsed, postid, accountid, username)); Assert.True(result); }
public IActionResult Delete(int id) { if (HttpContext.Session.GetInt32("User") != null) { AccountDetailVM account = new AccountDetailVM(); account = JsonConvert.DeserializeObject <AccountDetailVM>(HttpContext.Session.GetString("User")); if (account.Administrator) { Reply r = replyContainer.GetById(id); replyContainer.Delete(r); int postID = JsonConvert.DeserializeObject <int>(HttpContext.Session.GetString("Id")); return(Redirect("~/Post/Detail/?postID=" + postID)); } return(RedirectToAction("Index", "Login")); } return(RedirectToAction("Index", "Login")); }