TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Pedro Carvallo
NA
4
469
assigning ramdom numbers for all existing user
Oct 17 2017 11:04 PM
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);
}
Reply
Answers (
2
)
How to learn MVC framework in asp.net
ASP.NET MVC QUERY