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); }
public static bool Add(UserInfo usersInfo, ContacterInfo contacterInfo) { bool flag = false; if (dal.Add(usersInfo)) { flag = SaveContacter(contacterInfo); } return(flag); }
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)); }
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)); }
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); }
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); }
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))); }
/// <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")); }
public int Add(RoadFlow.Data.Model.Users model) { return(dataUsers.Add(model)); }
/// <summary> /// 新增用户 /// </summary> /// <param name="t"></param> /// <returns></returns> public int Add(Users t) { var result = iUsers.Add(t); return(result); }
public Task Post([FromBody] UserPost value) => _grain.Add(value.Parametr);