示例#1
0
        public async Task <IActionResult> Register(UserSignDTO userSignDTO)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    bool responseMsg = await _userServices.Register(userSignDTO);

                    if (responseMsg)
                    {
                        return(Ok(new ResponseCtrMsg <object>(CtrResult.Success)
                        {
                        }));
                    }
                    return(BadRequest(null));
                }
                catch (Exception ex)
                {
                    this._logger.LogInformation("An exception has occurred,the exception message:" + ex.Message);
                    return(BadRequest(new ResponseCtrMsg <object>(CtrResult.Exception)
                    {
                        ErrorObj = new Error()
                        {
                            ErrorMessage = ex.Message
                        }
                    }));
                }
            }
            else
            {
                return(BadRequest(new ResponseCtrMsg <object>(CtrResult.Failure)
                {
                    message = "传入的模型为空"
                }));
            }
        }