コード例 #1
0
ファイル: Program.cs プロジェクト: alikhil/DMD_Project
        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();
             * */
        }
コード例 #2
0
 public ActionResult Edit()
 {
     var appUser = User.Identity.GetAppUser();
     var tmp = new AppUser()
         {
             FirstName = appUser.FirstName,
             LastName = appUser.LastName
         };
     return View(tmp);
 }
コード例 #3
0
 public bool Add(AppUser user)
 {
     try
     {
         QueryExecutor.Instance.AddAppUser(user);
         return true;
     }
     catch
     {
         return false;
     }
 }
コード例 #4
0
        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);
        }
コード例 #5
0
ファイル: AppUserContext.cs プロジェクト: alikhil/DMD_Project
 public bool Add(AppUser user)
 {
     Global.Instance.UsersRepository.Add(user);
     return true;
 }
コード例 #6
0
 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);
 }
コード例 #7
0
 public bool UpdateAppUser(AppUser appUser)
 {
     return QueryExecutor.Instance.UpdateAppUser(appUser);
 }
コード例 #8
0
 public bool Add(AppUser user)
 {
     user.UserName = user.Email;
     Users.Add(user);
     return true;
 }
コード例 #9
0
 public bool UpdateAppUser(AppUser appUser)
 {
     var curAppUser = GetAppUser(appUser.Id);
     curAppUser.FirstName = appUser.FirstName;
     curAppUser.LastName = appUser.LastName;
     return true;
 }