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
Satnam Singh
NA
11
1.1k
db.SaveChanges(); not working plz help me
Jul 2 2016 12:24 PM
public ActionResult Register(Models.Registration user)
{
try
{
if (ModelState.IsValid)
{
using (var db = new LoginInMVC4WithEF.Models.UserEntities2())
{
var crypto = new SimpleCrypto.PBKDF2();
var encrypPass = crypto.Compute(user.Password);
var newUser = db.Registrations.Create();
newUser.Email = user.Email;
newUser.Password = encrypPass;
newUser.PasswordSalt = crypto.Salt;
newUser.FirstName = user.FirstName;
newUser.LastName = user.LastName;
newUser.UserType = "User";
newUser.CreatedDate = DateTime.Now;
newUser.IsActive = true;
newUser.IPAddress = "642 White Hague Avenue";
db.Registrations.Add(newUser);
db.SaveChanges();
return RedirectToAction("Index", "Home");
}
}
else
{
ModelState.AddModelError("", "Data is not correct");
}
}
Reply
Answers (
3
)
When button its clicked for the segond time. Its sturk...
Cookies and Sessions