public async Task <HttpResponseMessage> GetAllDataFromEntitleNewRequest(Guid requestId) { return(await ValidateAndHandleOperationExecutionAsync(async() => { var result = new EntitledData(); result.Entitle = await _entitleDomainService.GetEntitleById(UserIdentity); result.Debtors = await _entitleDomainService.GetDebtorsbyRequest(requestId); //else //result.Validation = await _entitleDomainService.GetValidationByRequest(requestId); //result.timeContributions = await _entitleDomainService.GetTimeContributionByRequest(requestId); return Request.CreateResponse(HttpStatusCode.OK, result); })); }
public async Task <HttpResponseMessage> SaveRequest(Request request) { return(await ValidateAndHandleOperationExecutionAsync(async() => { int?status = 0; //Validation val = null; TimeContribution tc = null; var ent = await _entitleDomainService.GetEntitleById(UserIdentity); var req = new Request(); if (request.RequestId == Guid.Empty) { // req.Date = DateTime.Now; req.Folio = "PEN" + ent.NoISSSTE.PadLeft(10, '0') + DateTime.Now.ToString("yyMMddhhmmss"); } else { req = await _requestDomainService.GetRequestByRequestId(request.RequestId); } // req.Description = request.Description; if (request.EntitleId != null) { req.EntitleId = request.EntitleId; } else { req.EntitleId = ent.CURP; } // req.IsAssigned = request.IsAssigned; request.Folio = req.Folio; req.IsComplete = status == 100 ? true : false; var result = await _requestDomainService.SaveRequest(req); var res = await _requestDomainService.SaveStatusRequestByEntitle(req, true, status, ent.CURP); if (!(bool)req.IsComplete) //0 en BD { await _requestDomainService.SaveStatusRequestByEntitle(req, true, (int)StatusEnum.EnesperadeAgendarCiraDer, ent.CURP); } //if (val != null); MFP 10-01-2017 //req.Validation = val; return Request.CreateResponse(HttpStatusCode.OK, req); })); }