public ActionResult Create([Bind(Include = "UserId,UserName,Password,EmailAddress,Role")] User user) { if (ModelState.IsValid) { db.Users.Add(user); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(user)); }
public ActionResult Create([Bind(Include = "RoleId,RoleName")] Role role) { if (ModelState.IsValid) { db.Roles.Add(role); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(role)); }
public CheckingController(CheckingContext profilecontext) { _profileContext = profilecontext; if (_profileContext.checking.Count() == 0) { //Profile 1 _profileContext.checking.Add(new Checking { username = "******", description = "Members 1st Checking Account", balance = 7577.23, lastActivityDate = DateTime.Now.ToString(), }); _profileContext.SaveChanges(); //Profile 2 _profileContext.checking.Add(new Checking { username = "******", description = "Members 1st Checking Account", balance = 21456.76, lastActivityDate = DateTime.Now.ToString(), }); _profileContext.SaveChanges(); //Profile 3 _profileContext.checking.Add(new Checking { username = "******", description = "Members 1st Checking Account", balance = 25000.54, lastActivityDate = DateTime.Now.ToString(), }); _profileContext.SaveChanges(); } }