Guest User

Untitled

a guest
Jan 17th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. public HttpResponseMessage GetExpediente()
  2. {
  3. db.Configuration.ProxyCreationEnabled = false;
  4. db.Configuration.LazyLoadingEnabled = true;
  5. var expediente = db.Expediente.Select(e => new ExpedientePOCO
  6. {
  7. idExpediente = e.idExpediente,
  8. NombreExpediente = e.NombreExpediente,
  9. CantidadDocumento = e.CantidadDocumento,
  10. DuenioExpediente = e.DuenioExpediente,
  11. FechaCreacion = e.FechaCreacion,
  12. Documentos = e.Documento.Select(x => new DocumentoPOCO
  13. {
  14. NombreDocumento = x.NombreDocumento,
  15. idExpediente = x.idExpediente,
  16. FechaCreacion = x.FechaCreacion,
  17. idDocumento = x.idDocumento,
  18. Archivos = x.Archivo.Select(a=>new ArchivoPOCO
  19. { idDocumento = a.idDocumento,
  20. idArchivo = a.idDocumento,
  21. NombreImagen = a.NombreImagen,
  22. ArchivoImg = a.ArchivoImg})
  23. })
  24. });
  25. if (expediente.Any())
  26. {
  27. return Request.CreateResponse(HttpStatusCode.OK, expediente);
  28. }
  29. else
  30. {
  31. return Request.CreateErrorResponse(HttpStatusCode.NotFound,
  32. "No se encontraron expedientes.");
  33. }
  34. }
Add Comment
Please, Sign In to add comment