Exemple #1
0
 public IActionResult Post([FromBody] Models.User.Request.UserPost userReq)
 {
     if (userReq != null)
     {
         userService.InsertUserAsync(userReq.Username, userReq.Email, userReq.Password);
         return(StatusCode(StatusCodes.Status200OK));
     }
     else
     {
         return(StatusCode(StatusCodes.Status400BadRequest));
     }
 }
Exemple #2
0
        public async Task <IActionResult> Put(long id, [FromBody] Models.User.Request.UserPost userReq)
        {
            if (userReq != null)
            {
                User user = new User {
                    Email = userReq.Email, Username = userReq.Username, Password = userReq.Password
                };
                await userService.UpdateUserAsync(id, userReq.Email, userReq.Username, userReq.Password);

                return(StatusCode(StatusCodes.Status200OK));
            }
            else
            {
                return(StatusCode(StatusCodes.Status400BadRequest));
            }
        }