title: Adding date.now to a controller with code allready inside it
body: <p>I have the following code in my controller:</p>
  
  <pre><code>// GET: /Review/Create
  public ActionResult Create()
      {
          var userGames = db.tblGames.Where(g =&gt; g.UserName == User.Identity.Name);
          ViewBag.GameIDFK = new SelectList(userGames, "GameID", "GameName");
          return View(new tblReview { UserName = @User.Identity.Name });
      } 
  </code></pre>
  
  <p>// POST: /Review/Create</p>
  
  <pre><code>    [HttpPost]
      public ActionResult Create(tblReview tblreview)
      {
          if (ModelState.IsValid)
          {
              db.tblReviews.Add(tblreview);
              db.SaveChanges();
              return RedirectToAction("Index");
          }
  
          var userGames = db.tblGames.Where(g =&gt; g.UserName == User.Identity.Name);
          ViewBag.GameIDFK = new SelectList(userGames, "GameID", "GameName");
          return View(new tblReview { UserName = @User.Identity.Name });
      }
  </code></pre>
  
  <p>And i want to add this line of code to it:</p>
  
  <pre><code>        return View(new tblReview { Posted = DateTime.Now });
  </code></pre>
  
  <p>But i dont know how to combine the code together. I have tried a If statement but the application fell apart as in it was just throwing errors everywhere. </p>
  
  <p>The reason i want to add these to codes together is so when a review is written the viewer can see the date the review was posted. I have a posted attribute in my database table and model for that looks like this:</p>
  
  <pre><code>namespace TestWebSite.Models
  {
      using System;
      using System.Collections.Generic;
  
      public partial class tblReview
      {
          public int ReviewID { get; set; }
          public string Recomendation { get; set; }
          public string AvoidOrBuy { get; set; }
          public string Score { get; set; }
          public System.DateTime Posted { get; set; }
          public int GameIDFK { get; set; }
          public string UserName { get; set; }
  
          public virtual tblGame tblGame { get; set; }
      }
  }
  </code></pre>
  
  <p>Thank you </p>
  
  <p>If you require addtional information please ask me </p>