public IActionResult ChangeStatus(int requestId, [FromBody] StringObject status) { if (status.content != RequestStatus.INACTIVE && status.content != RequestStatus.SENDING && status.content != RequestStatus.ACCEPTED && status.content != RequestStatus.REJECTED) { return(BadRequest()); } var result = _requestService.ChangeStatus(requestId, status.content); return(Ok(result)); }
public ActionResult ChangeStatus(int id, int status) { if (_requestService.ChangeStatus(id, status)) { TempData["ChangeStatus"] = "Đổi trạng thái thành công!"; } else { TempData["ChangeStatus"] = "Đổi trạng thái thất bại!"; } return(Redirect("/Admin/RequestDetails")); }
public async Task <Object> ApproveUserRequest(int requestID, [WebHTTP.FromUri] StatusChangeRequest request) { var userID = User.Claims.FirstOrDefault(p => p.Type == "UserID").Value; if (_requestService.CanupdateRequest(requestID, userID)) { var result = await _requestService.ChangeStatus(requestID, request.Status); return(result); } else { return(BadRequest("User is not allowed to approve time request")); } }