Tech
Forums
Jobs
Books
Events
Videos
Conference
Annual Conference
Bcrypt
Ai Conference
Live
More
Interviews
Certification
Training
Career
Members
News
Blogs
Contribute
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
2
Answers
assigning ramdom numbers for all existing user
Ask a question
Ask a question
Upload Source Code:
Select only zip and rar file.
Pedro Carvallo
6y
168
1
Reply
I have register 5 users in my app. I need assigning ramdom number for all of them but I cant I have no idea how to do that. It´s Like a temporary PIN for authentication. I have that code but only create the number , not insert the number to users
public
ActionResult Test(User user
)
{
Random rand =
new
Random();
int
numero = rand.Next(1, 10000);
var model =
new
User();
model.UserId = user.UserId;
model.Nombre = user.Nombre;
model.Codigo = numero;
db.Users.Add(model);
db.SaveChanges();
return
View(model);
}
Post
Reset
Cancel
Answers (
2
)
Next Recommended Forum
How to learn MVC framework in asp.net
ASP.NET MVC QUERY