static void Main(string[] args) { AppUser user = new AppUser() { Email = "*****@*****.**", FirstName = "azaz", LastName = "khil", PasswordHash = "ASDasdadasd", UserName = "******", Id = "228" }; var command = AutoSqlGenerator.Instance.Add(user); var dictionary = AutoSqlGenerator.Instance.ExecuteCommand("select * from client;"); Console.WriteLine(dictionary); Console.ReadKey(); /* Console.WriteLine(command); Console.ReadKey(); var dict = new List<KeyValuePair<string, string>>(); dict.Add(new KeyValuePair<string, string>("lastname", "'khil'")); dict.Add(new KeyValuePair<string, string>("firstname", "'azaz'")); var res = AutoSqlGenerator.Instance.Get<AppUser>(command); Console.WriteLine(res); Console.ReadKey(); * */ }
public ActionResult Edit() { var appUser = User.Identity.GetAppUser(); var tmp = new AppUser() { FirstName = appUser.FirstName, LastName = appUser.LastName }; return View(tmp); }
public bool Add(AppUser user) { try { QueryExecutor.Instance.AddAppUser(user); return true; } catch { return false; } }
public async Task<ActionResult> Register(RegisterViewModel model) { if (ModelState.IsValid) { var user = new AppUser() { Email = model.Email, FirstName = model.FirstName, LastName = model.LastName }; var result = await UserManager.CreateAsync(user, model.Password); if (result.Succeeded) { await SignInAsync(user, isPersistent: false); return RedirectToAction("Index", "Home"); } else { AddErrors(result); } } // If we got this far, something failed, redisplay form return View(model); }
public bool Add(AppUser user) { Global.Instance.UsersRepository.Add(user); return true; }
private async Task SignInAsync(AppUser user, bool isPersistent) { AuthenticationManager.SignOut(DefaultAuthenticationTypes.ExternalCookie); var identity = await UserManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie); AuthenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = isPersistent }, identity); }
public bool UpdateAppUser(AppUser appUser) { return QueryExecutor.Instance.UpdateAppUser(appUser); }
public bool Add(AppUser user) { user.UserName = user.Email; Users.Add(user); return true; }
public bool UpdateAppUser(AppUser appUser) { var curAppUser = GetAppUser(appUser.Id); curAppUser.FirstName = appUser.FirstName; curAppUser.LastName = appUser.LastName; return true; }