title: Displaying a DateTime + 1 year
body: <p>My goal is to get pull the latest date in training and and display it with 1 year added to it. I am using code fisrt and ASP.net MVC. My first table is called Person and it contains all basic if on a person. The second table is called Session and it contains all the previous dates and individual has been trained. Sessions.cs looks like this
      using System;
      using System.Collections.Generic;
      using System.ComponentModel.DataAnnotations;</p>
  
  <pre><code>namespace CleryAct.Models
  {
      public class Session
      {
  
          [Key]
          public int ID { get; set; }
          [StringLength(9, MinimumLength = 9, ErrorMessage = "Rocket Number must be longer than 9 characters.")]
          public string rockets { get; set; }
          [DataType(DataType.Date)]
          [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
          public DateTime training { get; set; }
  
          public virtual Person Person { get; set; }
      }
  }
  </code></pre>
  
  <p>The code for my view was generated my adding a new scaffolding item to my view and linking it to the persons database. I need +1 year to be displayed below but I am getting this error with the current code. </p>
  
  <pre><code>@foreach (var item in Model) {
      &lt;tr&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.csa)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.lname)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.fname)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.rockets)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.email)
          &lt;/td&gt;
          &lt;td&gt;
              @Html.DisplayFor(modelItem =&gt; item.Sessions.ElementAtOrDefault(0).training.AddYears(1))*
          &lt;/td&gt;
          &lt;td&gt;
  </code></pre>
  
  <p>The variable is a DateTime. I am using Razor MVC</p>