public async Task <IActionResult> LoginToken([FromHeader] string authorization) { try { var account = await jWTService.GetAccount(authorization); if (account != null) { return(Ok(new { code = 200, ma_kh = account.ma_kh, ma_dn = account.ma_dn, success = "Login token success" })); } else { return(NotFound(new { code = 400, error = "Account is not exist" })); } } catch (Exception e) { return(BadRequest(new { code = 400, error = "Login token fail" + e.InnerException.Message })); } }
async public Task <IActionResult> RequestJob([FromBody] RequestJob job, [FromHeader] string authorization) { Account org = await jWTService.GetAccount(authorization); if (org == null) { return(Unauthorized(new { success = false, code = 401, error = "Unauthorized" })); } if (org.ma_dn == null) { return(Forbid("Forbidden")); } job.ma_cong_ty = org.ma_dn; RequestJob requestJob = await requestJobRepository.Create(job); if (requestJob == null) { return(StatusCode(StatusCodes.Status500InternalServerError)); } return(Ok(new { success = true })); }