public IHttpActionResult GetComprobación(int idComp) { var compDTO = new ComprobacionDTO(); if (db.tblComprobacion.Find(idComp) != null) { var compGastot = from cg in db.tblComprobacionGastos where cg.IdComprobacion == idComp select cg; var gastosSinComp = from gsc in db.tblGastosSinComprobar where gsc.IdComprobacion == idComp select gsc; var totDiarios = from td in db.tblTotalDiario where td.IdComprobacion == idComp select td; var totGastos = from tg in db.tblTotalGastos where tg.IdComprabacion == idComp select tg; var comprobacion = from c in db.tblComprobacion select new ComprobacionDTO { IdSolicitud = c.Idcomprobacion, IdProyecto = c.IdProyecto, IdEmpleado = c.IdEmpleado, fecha = c.fecha, gerenteAdmin = c.gerenteAdmin, jefeInmediato = c.jefeInmediato, areaContable = c.areaContable, tblComprobacionGastos = compGastot, tblGastosSinComprobar = gastosSinComp, tblTotalDiario = totDiarios, tblTotalGastos = totGastos }; compDTO = AutoMapper.Mapper.Map <ComprobacionDTO>(comprobacion); } else { return(NotFound()); } return(Ok(compDTO)); }
public IHttpActionResult GetComprobación(int idComp) { var compDTO = new ComprobacionDTO(); if (db.tblComprobacion.Find(idComp) != null) { var compGastot = from cg in db.tblComprobacionGastos where cg.IdComprobacion == idComp select cg; var gastosSinComp = from gsc in db.tblGastosSinComprobar where gsc.IdComprobacion == idComp select gsc; var totDiarios = from td in db.tblTotalDiario where td.IdComprobacion == idComp select td; var totGastos = from tg in db.tblTotalGastos where tg.IdComprabacion == idComp select tg; var comprobacion = from c in db.tblComprobacion select new ComprobacionDTO { IdSolicitud = c.Idcomprobacion, IdProyecto = c.IdProyecto, IdEmpleado = c.IdEmpleado, fecha = c.fecha, gerenteAdmin = c.gerenteAdmin, jefeInmediato = c.jefeInmediato, areaContable = c.areaContable, tblComprobacionGastos = compGastot, tblGastosSinComprobar = gastosSinComp, tblTotalDiario = totDiarios, tblTotalGastos = totGastos }; compDTO = AutoMapper.Mapper.Map<ComprobacionDTO>(comprobacion); } else { return NotFound(); } return Ok(compDTO); }