title: How do I write a method that assigns a random number to a list of users?
body: <p>I need to create an application with MVC architecture. I need to generate random numbers 5 digits for users of my app. I mean, this method put on controller user , generate the numbers and show it in a view like a list (user + numbers sign) like a password </p>
  
  <p>Do you have any idea? sorry for my English. 
  I need it for a test</p>
  
  <pre><code>public class User
  {
      [Key]
      public int UserId { get; set; }
  
      public int Code { get; set; }
  
      public string Name { get; set; }
  }
  
  public ActionResult GenerateNumbers( User user)
  {
  
      Random rand = new Random();
      int numero = rand.Next(1, 10000);
      return View();
      var nuevoCodigo = new User
      {
          Name = user.Name,
          Code = numero,        
      };
      db.Users.Add(nuevoCodigo);
  }
  </code></pre>