public IActionResult Add(AgentPostData postData) { try { this.mgtService.AddAgent(postData.Account, postData.Password); return(Ok("新增代理商資料成功.")); } catch (Exception ex) { this.logger.LogError($"Add Agent Error >>> Account:{postData.Account} Password:{postData.Password}\n{ex}"); return(BadRequest("新增代理商資料發生錯誤.")); } }
public async Task <IActionResult> Login(AgentPostData postData) { try { string result = await this.mgtService.AgentLogin(postData.Account, postData.Password); if (string.IsNullOrEmpty(result)) { return(Ok("代理商登入成功.")); } return(BadRequest(result)); } catch (Exception ex) { this.logger.LogError($"Agent Login Error >>> Account:{postData.Account} Password:{postData.Password}\n{ex}"); return(BadRequest("代理商登入發生錯誤.")); } }