public void ReplyGetByIdTest(int id, string content, bool pinned, int postid, int accountid, string username) { ReplyDTO dto = new ReplyDTO(id, content, pinned, postid, accountid, username); ReplyDTO result = converter.ModelToDTO(container.GetById(id)); dto.Should().BeEquivalentTo(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")); }