public virtual HttpBaseResponse <T> Execute(AniDBHttpConnectionHandler handler) { Command = BaseCommand.Trim(); HttpBaseResponse <string> rawResponse = handler.GetHttp(Command); var response = ParseResponse(rawResponse); PostExecute(response); return(response); }
internal void BuildBadRequest(string message) { Success = false; HttpResponse = new HttpBaseResponse { Title = HttpStatusCode.BadRequest.ToString(), Status = (int)HttpStatusCode.BadRequest, ErrorDetails = new ErrorDetail { Detail = message, } }; }
public IActionResult ValidateAccessCode([FromBody] VerificationCodeModel model) { var response = new HttpBaseResponse { Success = false }; if (_accountService.ValidateAccessCode(model.PhoneNumber, model.Code)) { response.Success = true; } return(Ok(response)); }
public async Task <IActionResult> GetById(string id) { var account = await _accountService.Get(id); var response = new HttpBaseResponse { Success = false }; if (account != null) { response.Success = true; response.Object = JsonConvert.SerializeObject(account); } return(Ok(response)); }
public IActionResult GetByPhoneNumber(string phoneNumber) { var account = _accountService.GetByPhoneNumber(phoneNumber); var response = new HttpBaseResponse { Success = false }; if (account != null) { response.Success = true; response.Object = JsonConvert.SerializeObject(account); } return(Ok(response)); }
public async Task <IActionResult> GenerateAccessCode([FromBody] VerificationCodeModel model) { var userAccount = _accountService.GetByPhoneNumber(model.PhoneNumber); var response = new HttpBaseResponse { Success = false }; if (!string.IsNullOrEmpty(userAccount?.Id)) { var accessCode = await _accountService.GenerateAccessCode(userAccount.Id); if (!string.IsNullOrEmpty(accessCode)) { response.Success = true; response.Object = JsonConvert.SerializeObject(accessCode); } } return(Ok(response)); }
protected virtual void PostExecute(HttpBaseResponse <T> response) { }
protected abstract HttpBaseResponse <T> ParseResponse(HttpBaseResponse <string> receivedData);