예제 #1
0
 public async Task<ApiResponse<EmptyObject>> Register(RegisterBindingModel model)
 {
     RestRequest request = GetNewRequest();
     request.Resource = "Register";
     request.Method = Method.POST;
     request.AddObject(model);
     return await Execute<EmptyObject>(request, m_ManageApi, string.Empty);
 }
예제 #2
0
        public async Task<ActionResult> Register(RegisterBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);
            }

            ApiResponse<EmptyObject> response = await m_UserRepository.Register(model);
            return HandleApiResponse(response, View("Registered"), new HttpStatusCodeResult(HttpStatusCode.BadRequest));
        }
예제 #3
0
        public async Task<IHttpActionResult> Register(RegisterBindingModel model)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var user = new ApplicationUser() { UserName = model.Email, Email = model.Email };

            IdentityResult result = await UserManager.CreateAsync(user, model.Password);

            if (!result.Succeeded)
            {
                return GetErrorResult(result);
            }

            return Ok();
        }