title: ASP .NET MVC - Adding text from TextBox to table
body: <p>How can i add something to the list and display it in table in ASP .NET CORE MVC? I'm trying to do simple URL shortener, but I can't even pass full link to the view.</p>
  
  <p>My <strong>model</strong>: </p>
  
  <pre><code> public class Link
   {
      public string FullLink { get; set; }
      public string ShortenedLink { get; set; }
  
  
      public static List&lt;Link&gt; _list = new List&lt;Link&gt;();
  
  }
  </code></pre>
  
  <p>My <strong>controller</strong>:</p>
  
  <pre><code>public class LinkController : Controller
  {
      public IActionResult Index()
      {
          return View(Link._list);
      }
  
      [HttpPost]
      public IActionResult Add(string link)
      {
          Link._list.Add(new Link { FullLink = link });
          return RedirectToAction("Index");
      }
  }
  </code></pre>
  
  <p><strong>My view:</strong></p>
  
  <pre><code>@model List&lt;UrlShortener.Models.Link&gt;
  
  &lt;html&gt;
  &lt;head&gt;
      &lt;title&gt;&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
          @using (Html.BeginForm("Add", "Link", FormMethod.Post))
          {
          @Html.TextBox("myTextBox");
          &lt;input type="submit" value="Add" /&gt;
          }
      &lt;div&gt;
          &lt;table&gt;
             @foreach (var item in Model)
             {
              &lt;tr&gt;&lt;td&gt;@item.FullLink&lt;/td&gt;&lt;/tr&gt;
                 }
  &lt;/table&gt;
      &lt;/div&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Can someone explain me what am I doing wrong that after clicking "Add" button nothing happens?</p>