public ActionResult Index() { using (var ctx = new SampleAppContext()) { var customer = new Customer() { CustomerName = "Sujan" }; ctx.Customers.Add(customer); ctx.SaveChanges(); } return(View()); }
public AppUser Create(AppUser user, string password) { if (string.IsNullOrWhiteSpace(password)) { throw new Exception("Password is required"); } if (_context.Users.Any(x => x.Username == user.Username)) { throw new Exception("Username \"" + user.Username + "\" is already taken"); } SecurityUtils.CreatePasswordHash(password, out var passwordHash, out var passwordSalt); user.PasswordHash = passwordHash; user.PasswordSalt = passwordSalt; user.AppUserRole = AppUserRole.None; _context.Users.Add(user); _context.SaveChanges(); return(user); }
public int complete() { return(_context.SaveChanges()); }
protected void SaveChanges() { _context.SaveChanges(); }
//commit public virtual void Commit() { Context.SaveChanges(); }
public int Commit() { return(_context.SaveChanges()); }