partial void DeleteAccount(Account instance);
partial void InsertAccount(Account instance);
partial void UpdateAccount(Account instance);
public ActionResult Register(RegisterViewModel model) { if (ModelState.IsValid) { using (var connection = new FCDBDataContext()) { if (connection.Accounts.Any(account => account.Email == model.Email)) { ModelState.AddModelError("", "User with such email has been already regstered."); return View(model); } string userIpAddress = this.Request.UserHostAddress; if (connection.Accounts.Count(account => account.LastLoginIp == userIpAddress) > Constants.MaxNumberAccountsPerIp) { ModelState.AddModelError("", "Number of allowed users reached maximum."); return View(model); } var newUserAccount = new Account { Id = Guid.NewGuid(), Email = model.Email, PasswordHash = PasswordHash.PasswordHash.CreateHash(model.Password), Status = (int)UserAccountStatus.Active, Type = (int)UserAccountType.Player, Money = 0, CreatedOn = DateTime.Now, LastLoggedOn = DateTime.Now, LastLoginIp = userIpAddress }; connection.Accounts.InsertOnSubmit(newUserAccount); connection.SubmitChanges(); return this.RedirectToAction("Login"); } } // If we got this far, something failed, redisplay form return View(model); }