Beispiel #1
0
        private RestResult PostUser(IAccount account, IUsers users, ArraySegment <byte> content)
        {
            users.Add(account.Id,
                      Json.DeserializeObject <BaseUser>(GetContentString(content)));

            return(new RestResult());
        }
        public async Task <Unit> Handle(CreateUserCommand request, CancellationToken cancellationToken)
        {
            Validate(request);

            var user = new User(request.Name);
            await _users.Add(user);

            return(Unit.Value);
        }
Beispiel #3
0
        public static bool Add(UserInfo usersInfo, ContacterInfo contacterInfo)
        {
            bool flag = false;

            if (dal.Add(usersInfo))
            {
                flag = SaveContacter(contacterInfo);
            }
            return(flag);
        }
Beispiel #4
0
        public ActionResult Create([Bind(Include = "id,name,userName,email,password,registerDate,lastVisitDate,block")] Users user)
        {
            if (ModelState.IsValid)
            {
                usersHandler.Add(user);
                return(RedirectToAction("Index"));
            }

            ViewBag.UserGroups = new MultiSelectList(userGroupsHandler.All(), "id", "title", user.IdentityUserRoles);
            return(View(user));
        }
Beispiel #5
0
        public async Task <IActionResult> Register(RegisterViewModel model, string returnUrl = null)
        {
            ViewData["ReturnUrl"] = returnUrl;
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    Users usertodb = new Users
                    {
                        AddressStreet    = model.Address,
                        AddressCity      = model.AddressCity,
                        AddressState     = model.AddressState,
                        AddressZipcode   = model.AddressZipcode,
                        FirstName        = model.FirstName,
                        LastName         = model.LastName,
                        Birthday         = Convert.ToDateTime(model.BirthDate),
                        PhoneNumber      = Decimal.Parse(model.PhoneNumber),
                        UserName         = model.Email,
                        LastLoginAttempt = DateTime.Today,
                        MembershipDate   = DateTime.Today
                    };



                    // LIBDB Object...

                    _context.Add(usertodb);


                    // after saving changes to LIBDB

                    _logger.LogInformation("User created a new account with password.");

                    var code = await _userManager.GenerateEmailConfirmationTokenAsync(user);

                    var callbackUrl = Url.EmailConfirmationLink(user.Id, code, Request.Scheme);
                    await _emailSender.SendEmailConfirmationAsync(model.Email, callbackUrl);

                    await _signInManager.SignInAsync(user, isPersistent : false);

                    _logger.LogInformation("User created a new account with password.");
                    return(RedirectToLocal(returnUrl));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
Beispiel #6
0
 public Results AddAUser(Users user)
 {
     try
     {
         results.Result       = users.Add(user);
         results.Code         = 0;
         results.ErrorMessage = string.Empty;
     }
     catch (Exception ex)
     {
         logger.LogError(ex.Message);
         results.Code         = 1;
         results.ErrorMessage = ex.Message;
     }
     return(results);
 }
Beispiel #7
0
        public void Handle(ICommand command)
        {
            var createUserCommand = (CreateUserCommand)command;

            if (_users.Exists(createUserCommand.Email))
            {
                throw new Exception("Current user exists");
            }

            var user = new User(
                createUserCommand.Email,
                createUserCommand.Password,
                createUserCommand.FirstName,
                createUserCommand.LastName
                );

            _users.Add(user);
        }
Beispiel #8
0
        public IActionResult SignUp(UsersViewModel u, [FromServices] IUsers repositoryUsers)
        {
            Users user = new Users()
            {
                Email     = u.Email,
                Password  = u.Password,
                FirstName = u.FirstName,
                LastName  = u.LastName
            };

            try
            {
                repositoryUsers.Add(user);
            }
            catch (DbUpdateException)
            {
                return(View("RegistrationError"));
            }

            return(RedirectToAction(nameof(Index)));
        }
Beispiel #9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(WSS.Model.Users model)
 {
     return(dal.Add(model));
 }
 public ActionResult Register(User u)
 {
     users.Add(u);
     return(RedirectToAction("Index", "Home"));
 }
Beispiel #11
0
 public int Add(RoadFlow.Data.Model.Users model)
 {
     return(dataUsers.Add(model));
 }
Beispiel #12
0
        /// <summary>
        /// 新增用户
        /// </summary>
        /// <param name="t"></param>
        /// <returns></returns>
        public int Add(Users t)
        {
            var result = iUsers.Add(t);

            return(result);
        }
Beispiel #13
0
 public Task Post([FromBody] UserPost value) => _grain.Add(value.Parametr);