Ejemplo n.º 1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     var userName = User.Identity.Name;
     userName = (string.IsNullOrEmpty(userName) ? "Anonymous" : userName);
     var response = new BlogResponse()
         {
             Author = userName,
             Contents = txtBlogEntryReply.Text,
             BlogEntryId = _blogEntryId,
             ResponseDate = DateTime.Now
         };
     var repo = new BlogResponseRepository();
     repo.CreateBlogResponse(response);
     Response.Redirect("/Blog");
 }
 public void CreateBlogResponse(BlogResponse Response)
 {
     //TODO: should put this in a try/catch
     _context.BlogResponses.Add(Response);
     _context.SaveChanges();
 }