public async Task <IActionResult> Cancel(int requestId) { var request = await _unitOfWork.Requests.GetRequestById(requestId); if (request == null || request.Status != RequestStatus.Pending) { return(NotFound("Yêu cầu đã hết hiệu lực")); } await _requestService.Cancel(request); return(Ok()); }
public IResponseData <string> CancelRequest(Guid itemId) { IResponseData <string> response = new ResponseData <string>(); try { IRequestService service = IoC.Container.Resolve <IRequestService>(); service.Cancel(itemId); } catch (ValidationException ex) { response.SetErrors(ex.Errors); response.SetStatus(HttpStatusCode.PreconditionFailed); } return(response); }