public object CreateNewUser([FromBody] UserRequestDTO userData) { string token = Request.Headers.Authorization == null ? "" : Request.Headers.Authorization.ToString(); Logger.Info(Request.RequestUri + " || Method: " + Request.Method, Request.Headers.ToString(), JsonConvert.SerializeObject(userData), Level.INFO); ResponseDTO Response = new ResponseDTO(); ErrorDTO ErrorResponse = new ErrorDTO(); UserResponseDTO UserResponse = new UserResponseDTO(); Response = UserBUS.GetAllUserInfo(userData.username, "", 0); if (Response.Data == null) { Response = UserBUS.AddOrUpdateUser(userData); } else { ErrorResponse.Code = 400; ErrorResponse.Message = "Tài khoản đã tồn tại"; Response.Error = ErrorResponse; Response.Data = null; } return(Response); }
public object UpdateUser([FromBody] UserRequestDTO userData) { string token = Request.Headers.Authorization == null ? "" : Request.Headers.Authorization.ToString(); Logger.Info(Request.RequestUri + " || Method: " + Request.Method, Request.Headers.ToString(), JsonConvert.SerializeObject(userData), Level.INFO); ResponseDTO Response = new ResponseDTO(); ErrorDTO ErrorResponse = new ErrorDTO(); UserResponseDTO UserResponse = new UserResponseDTO(); Response = UserBUS.AddOrUpdateUser(userData); return(Response); }