예제 #1
0
파일: User.cs 프로젝트: rfrcode/pizzeria
        public static User Create(DTORegister register)
        {
            var user = new User();
            user.Name = register.Name;
            user.Email= register.Email;
            user.PassWord = register.PassWord; //TODO conviertir a encriptacion sha256

            /*   para la encriptación sha256
            https://docs.microsoft.com/es-es/dotnet/api/system.security.cryptography.sha256?view=netframework-4.8
            */
            return user;
        }
예제 #2
0
        //        public void Post([FromBody]DTORegister userRegister)
        public IActionResult Post(DTORegister userRegister)

        {  //error 404
            if (!ModelState.IsValid)
            {
                //ModelState.AddModelError("Name","error");
                //envia error 404  //https://docs.microsoft.com/es-es/aspnet/core/web-api/action-return-types?view=aspnetcore-3.1#iactionresult-type
                //muestra el error
                return(BadRequest(ModelState));
            }
            _userService.Register(userRegister);
            // muestra el json
            return(Ok(userRegister));
        }
예제 #3
0
 public void Register(DTORegister register)
 {
     var user = User.Create(register);
     /**TODO: Grabar en bb.ddd*/
 }