I have Register Model in Db the below post method in controller does the update to database . However I also want to update Login data model
[HttpPost]
public ActionResult Register(StudentDetail details)
{
if (DbAccess.LoginDetails.FirstOrDefault(student => student.Username == details.Username) == null)
{
DbAccess.StudentDetails.Add(details);
**//here i also want to update login table with added details in database**
DbAccess.SaveChanges();
return RedirectToAction("HomePage");
}
return View();
}
Below are the models created by entity framework db first
public StudentDetail()
{
this.UserFriends = new HashSet<UserFriend>();
}
public string StudentName { get; set; }
public string UnivName { get; set; }
public string City { get; set; }
public string Username { get; set; }
public string Password { get; set; }
public string EmailId { get; set; }
public virtual ICollection<UserFriend> UserFriends { get; set; }
}
public partial class LoginDetail
{
public string Username { get; set; }
public string Password { get; set; }
}
Can you guys suggest me the call to update LoginDetail table also with the Username and Password in that post method.
thanks,
Michaeld