public void Test_Register_Fail() { var regModel = new RegisterBindingModel() { FirstName = "Sam", LastName = "Sammuel", Age = 23, Email = "*****@*****.**", Password = "******", PasswordConfirmation = "Welcome20!9" }; var unexpResult = new RegisterApiModel() { Message = "User has not been created", Success = false }; using (var context = GetContext()) { var service = new AuthService(_repo, _mapper); var actResult = service.Register(regModel); Assert.IsFalse(actResult.Message == unexpResult.Message); Assert.IsFalse(actResult.Success == unexpResult.Success); } }
public async Task <ActionResult <AbstractResponseApiModel> > Register([FromBody] RegisterApiModel form) { UserDTO user = new UserDTO { Email = form.Email, Password = form.Password }; user = await _userService.RegisterWithConfirmationCode(user); string encodedCode = WebEncoders.Base64UrlEncode( Encoding.UTF8.GetBytes(user.EmailCode)); //TODO: convert the following to a proper url object. Currently //using Request to construct the URL. This may become a security concern. string confirmEmailUrl = Request.Scheme + "://" + Request.Host + $"/api/users/{user.Id}/email/confirm?code={encodedCode}"; var message = $"Please confirm your account by <a href='{HtmlEncoder.Default.Encode(confirmEmailUrl)}'>clicking here</a>."; await _emailService.SendEmailAsync(user.Email, EMAIL_CONFIRM_SUBJECT, message); //TODO: send the generated URL to email return(Accepted("/users/{user.Id}", new OkResponseApiModel { Message = PLEASE_CONFIRM_MSG })); }
public IHttpActionResult Register(RegisterApiModel model) { try { if (ModelState.IsValid) { var user = new ApplicationUser { UserName = model.Email, Email = model.Email }; var result = UserManager.Create(user, model.Password); if (!result.Succeeded) { return(getErrorResult(result)); } return(Ok()); } return(BadRequest(ModelState)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public async Task <IHttpActionResult> Register(RegisterApiModel model) { if (ModelState.IsValid && model != null) { var user = Mapper.Map <RegisterApiModel, User>(model); user.Id = Guid.NewGuid().ToString(); user.Enabled = true; var result = await this.userManager.CreateAsync(user, model.Password); if (result.Succeeded) { if ((await this.userManager.AddToRoleAsync(user.Id, "user")).Succeeded) { var confirmToken = await this.userManager.GenerateEmailConfirmationTokenAsync(user.Id); await userManager.SendEmailAsync(user.Id, "Confirmation email!", string.Format("Activate your account by clicking here: {0}/confirm?id={1}&token={2}", HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority, user.Id, HttpUtility.UrlEncode(confirmToken))); return(Ok(new ApiResponse(200, Mapper.Map <UserApiModel>(user)))); } } else { return(this.BadRequest(new ApiResponse(400, Mapper.Map <UserApiModel>(model)))); } } return(this.BadRequest(new ApiResponse(400, Mapper.Map <UserApiModel>(model)))); }
public async Task <IHttpActionResult> Post(RegisterApiModel registerApiModel) { var userManager = HttpContext.Current.GetOwinContext().GetUserManager <ApplicationUserManager>(); User user = userManager.Find(registerApiModel.UserName, registerApiModel.Password); if (user == null) { user = new User { UserName = registerApiModel.UserName, Profile = new Profile { firstname = registerApiModel.firstname, lastname = registerApiModel.lastname, email = registerApiModel.email } }; var result = await userManager.CreateAsync(user, registerApiModel.Password); if (result.Succeeded) { return(Ok(await userManager.FindAsync(registerApiModel.UserName, registerApiModel.Password))); } else { throw new HttpResponseException(HttpStatusCode.InternalServerError); } } else { return(null); } }
public async Task Register(RegisterApiModel registerApimodel) { if (ModelState.IsValid) { var user = new UserModel { UserName = registerApimodel.Email, Email = registerApimodel.Email, PhoneNumber = registerApimodel.PhoneNumber }; var result = await _userManager.CreateAsync(user, registerApimodel.Password); if (result.Succeeded) { _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(registerApimodel.Email, callbackUrl); _logger.LogInformation("Email address confirmation has been sent."); } else { _logger.LogInformation("User not created."); } } }
public async Task Register_ReturnsOkResult_WhenModelIsValid() { // todo move it to _sut.Register var model = new RegisterApiModel(); var result = await _sut.Register(model); Assert.IsType(typeof(OkResult), result); }
public async Task Register_CallsRegisterMethod_WhenModelIsValid() { // todo move it to _sut.Register var model = new RegisterApiModel(); await _sut.Register(model); _accountServiceMock.Verify(accountService => accountService.RegisterAsync(It.IsAny <RegisterModelDto>()), Times.Once); }
public IActionResult RegisterAsUser([FromBody] RegisterApiModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(ReturnResult(_accountService.Create(model.To(UserRole.User)) .ConvertToResult(user => JwtTokenApiModel.From(user, _settings)))); }
public async Task <ApiResult> AddFaceToPerson(RegisterApiModel data) { var base64Array = Convert.FromBase64String(data.FaceData); var arrayContent = new ByteArrayContent(base64Array); arrayContent.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); var result = await _personService.AddFace(data.PersonGroupId, data.PersonId, arrayContent, data.UserData); return(result); }
// POST api/register //目前仅这个在用 public Object Post(RegisterApiModel obj) { string msg; try { if (string.IsNullOrEmpty(obj.UserId)) { msg = string.Format(XiaoluResources.MSG_CREATE_FAIL, obj.UserId) + string.Format(XiaoluResources.STR_FAIL_RESAON, XiaoluResources.MSG_USER_ID_IS_NULL); return(new { IsSuccess = false, Message = msg }); } if (string.IsNullOrEmpty(obj.Mobile)) { msg = string.Format(XiaoluResources.MSG_CREATE_FAIL, obj.UserId) + string.Format(XiaoluResources.STR_FAIL_RESAON, XiaoluResources.MSG_MOBILE_IS_NULL); return(new { IsSuccess = false, Message = msg }); } if (string.IsNullOrEmpty(obj.Password) || obj.Password.Trim().Length < 6) { msg = string.Format(XiaoluResources.MSG_CREATE_FAIL, obj.UserId) + string.Format(XiaoluResources.STR_FAIL_RESAON, XiaoluResources.MSG_PASSWORD_IS_NOT_VALID); return(new { IsSuccess = false, Message = msg }); } User userInDb = BusinessService.GetUserByName(obj.UserId); if (userInDb != null) { msg = string.Format(XiaoluResources.MSG_CREATE_FAIL, obj.UserId) + string.Format(XiaoluResources.STR_FAIL_RESAON, XiaoluResources.MSG_USER_ID_ALREAY_EXIST); return(new { IsSuccess = false, Message = msg }); } userInDb = BusinessService.GetUserByMobile(obj.Mobile); if (userInDb != null) { msg = string.Format(XiaoluResources.MSG_CREATE_FAIL, obj.UserId) + string.Format(XiaoluResources.STR_FAIL_RESAON, XiaoluResources.MSG_MOBILE_ALREAY_EXIST); return(new { IsSuccess = false, Message = msg }); } User obj4save = new User() { Name = obj.UserId, Mobile = obj.Mobile, Password = FormsAuthentication.HashPasswordForStoringInConfigFile(obj.Password, "MD5") }; BaseActionResult result = BusinessService.CreateUser(obj4save); return(new { IsSuccess = result.IsSuccess, Message = result.Message }); } catch (Exception e) { msg = string.Format(XiaoluResources.MSG_CREATE_FAIL, obj.UserId) + string.Format(XiaoluResources.STR_FAIL_RESAON, ExceptionHelper.GetInnerExceptionInfo(e)); return(new { IsSuccess = false, Message = msg }); } }
public IHttpActionResult Regiter(RegisterApiModel data) { return(Ok(new UserInfoApiModel { Id = 1, Name = "Ali", Surname = "Basli", Email = "*****@*****.**", Birthday = "01-01-1990", Gender = "Male" })); }
public async Task Register(RegisterApiModel model) { var tokens = await _accountService.RegisterUserAsync(model); await _jSRuntime.SetInLocalStorage(jwtKey, tokens.Token); await _jSRuntime.SetInLocalStorage(tokenRefreshKey, tokens.RefreshToken); var authState = BuildAuthenticationState(tokens.Token); NotifyAuthenticationStateChanged(Task.FromResult(authState)); }
private void GivenUser() { const string password = "******"; _registerApiModel = new RegisterApiModel { Name = "stub-register-name", Email = "stub-register@email", Password = password, ConfirmPassword = password }; }
public async Task <ActionResult <RegisterOutput> > RegisterAsync([FromBody] RegisterApiModel model) { RegisterInput input = new RegisterInput(); input.Name = model.AccountID; input.Surname = model.AccountID; input.UserName = model.AccountID; input.Password = model.Password; input.TenantId = _AbpSession.TenantId; RegisterOutput output = await _AccountAppService.Register(input); return(output); }
public async Task <IActionResult> Register([FromBody] RegisterApiModel model) { if (ModelState.IsValid) { ApplicationUser user = new ApplicationUser { UserName = model.Email, Email = model.Email }; IdentityResult result = await _userManager.CreateAsync(user, model.Password); return(Json(result)); } return(Json(ModelState)); }
public async Task <RegisterResponse> Register(RegisterViewModel viewModel) { var apiModel = new RegisterApiModel { ConfirmPassword = viewModel.ConfirmPassword, Email = viewModel.Email, Password = viewModel.Password }; var response = await ApiClient.PostJsonEncodedContent(RegisterUri, apiModel); var registerResponse = await CreateJsonResponse <RegisterResponse>(response); return(registerResponse); }
public async Task <IActionResult> Register([FromBody] RegisterApiModel model) { if (ModelState.IsValid) { var registerModelDto = _mapper.Map <RegisterModelDto>(model); await _accountService.RegisterAsync(registerModelDto); _logger.LogInformation($"User was registration with email: {model.Email}"); return(Ok()); } return(BadRequest(ModelState)); }
public async Task <IActionResult> CreatePerson([FromBody] RegisterApiModel data) { if (data == null) { return(new BadRequestObjectResult("Data is empty")); } var successfullyRegistered = await _registrationFactory.RegisterUser(data); if (successfullyRegistered) { return(new OkResult()); } return(new BadRequestObjectResult("Registration failed")); }
public async Task <IActionResult> Register([FromBody] RegisterApiModel model) { if (!ModelState.IsValid) { var errorList = new List <string>(); foreach (var modelState in ViewData.ModelState.Values) { foreach (var error in modelState.Errors) { errorList.Add(error.ErrorMessage.Replace("\"", string.Empty)); } } return(BadRequest(errorList)); } var user = await _userManager.FindByEmailAsync(model.Email); if (user != null) { return(BadRequest("A user with that e-mail address already exists!")); } user = new IdentityUser { UserName = model.Email.Split("@").FirstOrDefault(), Email = model.Email, EmailConfirmed = true, LockoutEnabled = true }; var registerResult = await _userManager.CreateAsync(user, model.Password); if (!registerResult.Succeeded) { var result = registerResult.Errors; return(registerResult.Errors.Count() == 1 ? BadRequest(registerResult.Errors.First().Description) : BadRequest(registerResult.Errors.Select(err => err.Description).ToArray())); } await _userManager.AddToRoleAsync(user, "Customer"); return(Ok()); }
public async Task <bool> RegisterUser(RegisterApiModel data) { var personResponse = await _personRepository.CreatePersonId(data); if (!personResponse.IsSuccessStatusCode) { return(false); } var personId = JObject.Parse(personResponse.ResponseBody).GetValue("personId").ToString(); data.PersonId = personId; var faceResponse = await _personRepository.AddFaceToPerson(data); return(faceResponse.IsSuccessStatusCode); }
public async Task <ApiResult> CreatePersonId(RegisterApiModel data) { var o = new { name = data.Name, userData = data.UserData }; var payload = new StringContent(JsonConvert.SerializeObject(o)); payload.Headers.ContentType = new MediaTypeHeaderValue("application/json"); var result = await _personService.Create(data.PersonGroupId, payload); await _personService.Train(data.PersonGroupId); return(result); }
public Task <HttpResponseMessage> CompanyInfo() { var baseUrl = string.Format("{0}://{1}/{2}", HttpContext.Current.Request.Url.Scheme, HttpContext.Current.Request.Url.Authority, "api/site/file/view/"); return(Task <HttpResponseMessage> .Factory.StartNew(() => { try { var restaurant = CurrentAppContext.Restaurants .Include(r => r.Tags) .Include(r => r.Cards) .FirstOrDefault(r => r.Id == CurrentRestaurantId); if (restaurant == null) { return Request.CreateResponse(HttpStatusCode.OK, new RegisterApiModel()); } var registerApiModel = new RegisterApiModel { Name = restaurant.Name, Description = restaurant.Description, Email = restaurant.Email, Url = UnFormatUrl(restaurant.Url), Cards = restaurant.Cards.Select(c => c.Id).ToList(), Tags = restaurant.Tags.Select(t => t.Id).ToList(), LogoPath = !string.IsNullOrEmpty(restaurant.LogoPath) ? string.Format("{0}{1}", baseUrl, restaurant.LogoPath) : "", HasImage = (string.IsNullOrEmpty(restaurant.LogoPath) == false) }; return Request.CreateResponse(HttpStatusCode.OK, registerApiModel); } catch (Exception exception) { ErrorLog.GetDefault(HttpContext.Current).Log(new Error(exception)); return Request.CreateResponse(HttpStatusCode.BadRequest, MessagesResources.GeneralError); } })); }
public async Task <IActionResult> Post([FromBody] RegisterApiModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var userIdentity = _mapper.Map <PortalUser>(model); var result = await userManager.CreateAsync(userIdentity, model.Password); if (!result.Succeeded) { return(new BadRequestObjectResult(Errors.AddErrorsToModelState(result, ModelState))); } await appDbContext.SaveChangesAsync(); return(Ok()); }
public async Task <RegisterResponse> RegisterByKiosk(RegisterBindingModel viewModel) { var apiModel = new RegisterApiModel { NamaRekanan = viewModel.NamaRekanan, NomorNPWP = System.Guid.NewGuid().ToString(), Email = viewModel.Email, Password = viewModel.Password, ConfirmPassword = viewModel.ConfirmPassword, IdTypeOfRekanan = viewModel.IdTypeOfRekanan }; string urlModel = ConfigurationManager.AppSettings["SmartAPIUrl"]; var response = await ApiClient.PostJsonEncodedContent(string.Format("{0}/{1}", urlModel, RegisterUri), apiModel); var responseRek = await ApiClient.PostJsonEncodedContent(string.Format("{0}/{1}", urlModel, RegisterUriRek), apiModel); //var response = await ApiClient.PostJsonEncodedContent(string.Format("{0}/{1}", urlModel, RegisterUri), viewModel); var registerResponse = await CreateJsonResponse <RegisterResponse>(response); return(registerResponse); }
public HttpResponseMessage CompanySave([FromBody] RegisterApiModel model) { try { if (ModelState.IsValid == false) { return(Request.CreateResponse(HttpStatusCode.BadRequest, MessagesResources.CompanyInvalidData)); } var restaurant = CurrentAppContext.Restaurants .Include(r => r.Locations) .Include(r => r.Tags) .Include(r => r.Cards) .FirstOrDefault(r => r.Id == CurrentRestaurantId); if (restaurant == null) { var user = CurrentAppContext.Users.FirstOrDefault(u => u.Id == CurrentUserId); if (user == null) { return(Request.CreateResponse(HttpStatusCode.BadRequest, MessagesResources.LoggedUserNotValid)); } //new var entityCards = CurrentAppContext.Cards.Where(c => model.Cards.Contains(c.Id)).ToList(); var entityTags = CurrentAppContext.Tags.Where(t => model.Tags.Contains(t.Id)).ToList(); var entityRestaurant = new Restaurant { Id = Guid.NewGuid(), Name = model.Name, Email = model.Email, Description = model.Description, Url = FormatUrl(model.Url), Active = true, }; entityCards.ForEach(c => entityRestaurant.Cards.Add(c)); entityTags.ForEach(t => entityRestaurant.Tags.Add(t)); user.Restaurant = entityRestaurant; CurrentAppContext.Restaurants.Add(entityRestaurant); CurrentAppContext.SaveChanges(); } else //edit { restaurant.Name = model.Name; restaurant.Email = model.Email; restaurant.Description = model.Description; restaurant.Url = FormatUrl(model.Url); restaurant.Active = true; var entityCards = CurrentAppContext.Cards.Where(c => model.Cards.Contains(c.Id)).ToList(); var entityTags = CurrentAppContext.Tags.Where(t => model.Tags.Contains(t.Id)).ToList(); restaurant.Tags.ToList().ForEach(tag => restaurant.Tags.Remove(tag)); restaurant.Cards.ToList().ForEach(card => restaurant.Cards.Remove(card)); entityCards.ForEach(c => restaurant.Cards.Add(c)); entityTags.ForEach(t => restaurant.Tags.Add(t)); CurrentAppContext.SaveChanges(); } return(Request.CreateResponse(HttpStatusCode.OK, MessagesResources.GeneralSaveSucces)); } catch (Exception exception) { ErrorLog.GetDefault(HttpContext.Current).Log(new Error(exception)); return(Request.CreateResponse(HttpStatusCode.BadRequest, MessagesResources.GeneralError)); } }
public async Task <ActionResult <ApiResultDataModel <RegisterOutput> > > RegisterAsync([FromBody] RegisterApiModel model) { if (ValidateModel() == false) { return(new ApiResultDataModel <RegisterOutput>(_ValidateModelErrors)); } string validateCode = _ValidateCodeHelper.GetValidateCode(); if (!string.Equals(validateCode, model.VaildCode, StringComparison.OrdinalIgnoreCase)) { return(new ApiResultDataModel <RegisterOutput>() { IsSuccess = false, Message = "验证码错误" }); } RegisterOutput output; RegisterInput input = new RegisterInput(); input.Name = model.AccountID; input.Surname = model.AccountID; input.UserName = model.AccountID; input.Password = model.Password; input.TenantId = _AbpSession.TenantId; output = await _AccountAppService.Register(input); return(new ApiResultDataModel <RegisterOutput>(output)); }
public async Task <ApiResult> AddTest(RegisterApiModel model) { if (string.IsNullOrWhiteSpace(model.Name)) { return new ApiResult { status = 0, msg = "请输入名称" } } ; if (string.IsNullOrWhiteSpace(model.SchoolName)) { return new ApiResult { status = 0, msg = "请输入学校名" } } ; if (string.IsNullOrWhiteSpace(model.ContactPhone)) { return new ApiResult { status = 0, msg = "请输入联系方式" } } ; if (model.Sex != 0 && !(model.Sex >= 1 & model.Sex <= 2)) { return new ApiResult { status = 0, msg = "性别错误" } } ; //if (string.IsNullOrWhiteSpace(model.VerifyCode)) // return new ApiResult { status = 0, msg = "请输入验证码" }; User user = JwtHelper.JwtDecrypt <User>(ControllerContext); //if(HttpContext.Current.Session["VerifyCode" + user.Id] == null) // return new ApiResult { status = 0, msg = "验证码已过期" }; //string code = HttpContext.Current.Session["VerifyCode" + user.Id].ToString(); //if(!model.VerifyCode.Equals(code)) // return new ApiResult { status = 0, msg = "验证码错误" }; var regModel = await registerService.GetModelByUserIdAsync(user.Id); //if (regModel != null) //{ // if (regModel.Flag == 0) // return new ApiResult { status = 0, msg = "您已报名,请等待审核" }; // if (regModel.Flag == 1) // return new ApiResult { status = 0, msg = "您已成功报名,不能重复操作" }; //} RegisterDTO dto = new RegisterDTO(); dto.UserId = user.Id; dto.Name = model.Name; dto.Sex = model.Sex; dto.TeamName = model.TeamName; dto.SchoolName = model.SchoolName; dto.Profession = model.Profession; dto.ContactPhone = model.ContactPhone; dto.QQ = model.QQ; dto.Flag = 1; dto.FlagTime = DateTime.Now; long regid = await registerService.AddAsync(dto); var res = await registerService.Audit(regid); if (!res) { return new ApiResult { status = 1, msg = "报名失败" } } ; else { return new ApiResult { status = 1, msg = "报名成功" } }; }
public async Task <ApiResult> Add(RegisterApiModel model) { if (string.IsNullOrWhiteSpace(model.Name)) { return new ApiResult { status = 0, msg = "请输入名称" } } ; if (string.IsNullOrWhiteSpace(model.SchoolName)) { return new ApiResult { status = 0, msg = "请输入学校名" } } ; if (string.IsNullOrWhiteSpace(model.ContactPhone)) { return new ApiResult { status = 0, msg = "请输入联系方式" } } ; if (model.Sex != 0 && !(model.Sex >= 1 & model.Sex <= 2)) { return new ApiResult { status = 0, msg = "性别错误" } } ; //if (string.IsNullOrWhiteSpace(model.VerifyCode)) // return new ApiResult { status = 0, msg = "请输入验证码" }; User user = JwtHelper.JwtDecrypt <User>(ControllerContext); //if(HttpContext.Current.Session["VerifyCode" + user.Id] == null) // return new ApiResult { status = 0, msg = "验证码已过期" }; //string code = HttpContext.Current.Session["VerifyCode" + user.Id].ToString(); //if(!model.VerifyCode.Equals(code)) // return new ApiResult { status = 0, msg = "验证码错误" }; #region 验证数据 var regModel = await registerService.GetModelByUserIdAsync(user.Id); if (regModel != null) { if (regModel.Flag == 0) { return new ApiResult { status = 0, msg = "您已报名,请等待审核" } } ; if (regModel.Flag == 1) { return new ApiResult { status = 0, msg = "您已成功报名,不能重复操作" } } ; } bool bTeamName = await registerService.ExistsByTeamNameAsync(model.TeamName); if (bTeamName) { return new ApiResult { status = 0, msg = "该团队名称已被注册" } } ; bool bPhone = await registerService.ExistsByContactPhoneAsync(model.ContactPhone); if (bTeamName) { return new ApiResult { status = 0, msg = "该手机号已被注册" } } ; if (!string.IsNullOrWhiteSpace(model.AMobile)) { if (model.AMobile.Equals(model.ContactPhone)) { return new ApiResult { status = 0, msg = "手机号不能重复" } } ; var memModel = await memberService.GetModelByMobileAsync(model.AMobile); if (memModel != null) { return new ApiResult { status = 0, msg = "A成员手机号已被注册" } } ; } if (!string.IsNullOrWhiteSpace(model.BMobile)) { if (model.BMobile.Equals(model.AMobile) || model.BMobile.Equals(model.ContactPhone)) { return new ApiResult { status = 0, msg = "手机号不能重复" } } ; var memModel = await memberService.GetModelByMobileAsync(model.BMobile); if (memModel != null) { return new ApiResult { status = 0, msg = "B成员手机号已被注册" } } ; } if (!string.IsNullOrWhiteSpace(model.CMobile)) { if (model.CMobile.Equals(model.BMobile) || model.CMobile.Equals(model.AMobile) || model.CMobile.Equals(model.ContactPhone)) { return new ApiResult { status = 0, msg = "手机号不能重复" } } ; var memModel = await memberService.GetModelByMobileAsync(model.CMobile); if (memModel != null) { return new ApiResult { status = 0, msg = "C成员手机号已被注册" } } ; } if (!string.IsNullOrWhiteSpace(model.DMobile)) { if (model.DMobile.Equals(model.CMobile) || model.DMobile.Equals(model.BMobile) || model.DMobile.Equals(model.AMobile) || model.DMobile.Equals(model.ContactPhone)) { return new ApiResult { status = 0, msg = "手机号不能重复" } } ; var memModel = await memberService.GetModelByMobileAsync(model.DMobile); if (memModel != null) { return new ApiResult { status = 0, msg = "D成员手机号已被注册" } } ; } #endregion RegisterDTO dto = new RegisterDTO(); dto.UserId = user.Id; dto.Name = model.Name; dto.Sex = model.Sex; dto.TeamName = model.TeamName; dto.SchoolName = model.SchoolName; dto.Profession = model.Profession; dto.ContactPhone = model.ContactPhone; dto.QQ = model.QQ; dto.Flag = 1; dto.FlagTime = DateTime.Now; long regid = await registerService.AddAsync(dto); if (!string.IsNullOrWhiteSpace(model.AMobile)) { await memberService.AddAsync(regid, model.AName, model.AMobile, 1); } if (!string.IsNullOrWhiteSpace(model.BMobile)) { await memberService.AddAsync(regid, model.BName, model.BMobile, 1); } if (!string.IsNullOrWhiteSpace(model.CMobile)) { await memberService.AddAsync(regid, model.CName, model.CMobile, 1); } if (!string.IsNullOrWhiteSpace(model.DMobile)) { await memberService.AddAsync(regid, model.DName, model.DMobile, 1); } var res = await registerService.Audit(regid);//审核通过,并匹配已绑定手机的用户,进入团队 if (!res) { return new ApiResult { status = 0, msg = "报名失败" } } ; else { return new ApiResult { status = 1, msg = "报名成功" } }; }
public async Task <TokenApiModel> RegisterUserAsync(RegisterApiModel model) { return(await _httpService.Post <RegisterApiModel, TokenApiModel>(ApiUrls.RegisterUrl, model)); }