public Request Approve(ApproveRequestContext context) { var request = _requestRepository.GetRequest(context.Request.Id); var requestWorkflow = CreateRequestWorkflow(request.Status); requestWorkflow.TriggerWorkflow(RequestTrigger.Approve); request.Status = requestWorkflow.Status; request.UpdatedOn = DateTime.UtcNow; _requestRepository.Save(request); return(request); }
public IHttpActionResult Approve(ApproveRequestModel approveRequestModel) { using (_domainContext) { var requestContext = new ApproveRequestContext { Request = new Request { Id = approveRequestModel.Id } }; var request = _requestService.Approve(requestContext); _domainContext.SaveChanges(); return(Json(request)); } }