public void ReplyInsertTest(int id, string content, bool pinned, string date, int postid, int accountid, string username) { DateTime DateParsed = DateTime.Parse(date); long result = container.Insert(new Reply(id, content, pinned, DateParsed, postid, accountid, username)); Reply r = container.GetById(1); Assert.Equal(r.Id, result); }
public IActionResult Create(ReplyDetailVM vm) { if (HttpContext.Session.GetInt32("User") != null) { Reply reply = vmconverter.ViewModelToModel(vm); AccountDetailVM account = new AccountDetailVM(); account = JsonConvert.DeserializeObject <AccountDetailVM>(HttpContext.Session.GetString("User")); int accountID = account.Id; int postID = JsonConvert.DeserializeObject <int>(HttpContext.Session.GetString("Id")); reply.PostId = postID; reply.AccountId = accountID; reply.Username = account.Username; replyContainer.Insert(reply); return(Redirect("~/Post/Detail/?postID=" + postID)); } return(RedirectToAction("Index", "Login")); }