title: How to display the username after login
body: <p>I have to learn C# MVC using <code>LINQ</code>. Now I don't know how to send the username after login</p>
  
  <p>How to send the username from the database to view?</p>
  
  <pre><code>public ActionResult Login(Login log)
  {
      using (var dbs = new guruEntities())
      {
          var check = dbs.Logins.FirstOrDefault(x =&gt; x.Name == log.Name &amp;&amp; x.Password == log.Password);
          if (check != null)
          {
              return RedirectToAction("Success");
          }
          else
          {
              ViewBag.msg = "Wrong data";
          }
      }
      return View("Login");
  }
  
  public ActionResult Success(Login log)
  {
      using (var dbs = new guruEntities())
      {
          var check = dbs.Logins.FirstOrDefault(x =&gt; x.Name == log.Name &amp;&amp; x.Password == log.Password);
  
          return View();
      }
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>&lt;div&gt; 
      Welcome &lt;!--How do I display the Username here? --&gt;
  &lt;/div&gt;
  </code></pre>