示例#1
0
        // GET: ConsultaCicloDadiva/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var dador = _encryptor.DecryptData(await _context.Dador
                                               .SingleOrDefaultAsync(m => m.DadorId == id));

            if (dador == null)
            {
                return(NotFound());
            }

            return(View(dador));
        }
        // GET: ConsultaDestinosGametas/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var dador = _encryptor.DecryptData(await _context.Dador
                                               .SingleOrDefaultAsync(m => m.DadorId == id));

            if (dador == null)
            {
                return(NotFound());
            }

            var amostras = await _context.Amostra
                           .Where(a => a.DadorId == id)
                           .Where(a => a.EstadoAmostra == EstadoAmostraEnum.Enviada)
                           .ToListAsync();

            ICollection <ConsultaDestinosGametasViewModel> model = new List <ConsultaDestinosGametasViewModel>();

            foreach (Amostra a in amostras)
            {
                var pma = await _context.PedidoGametas.Where(pg => pg.AmostraId == a.AmostraId).SingleOrDefaultAsync();

                if (pma != null)
                {
                    ConsultaDestinosGametasViewModel cdgVM = new ConsultaDestinosGametasViewModel
                    {
                        NrEnvio    = pma.PedidoGametasId,
                        NrAmostra  = a.AmostraId,
                        NomeDador  = dador.Nome,
                        Centro     = pma.Centro,
                        DataEnvio  = DateTime.UtcNow,
                        RefExterna = pma.RefExterna
                    };

                    model.Add(cdgVM);
                }
            }

            return(View(model));
        }
        // -------------------------------------------------------------------------------------------------------------------------
        // GET: Dadors/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var dador = _encryptor.DecryptData(await _context.Dador
                                               .SingleOrDefaultAsync(m => m.DadorId == id));

            dador.Resposta = await _context.Resposta.Where(x => x.DadorId == dador.DadorId).Include(x => x.Pergunta).ToListAsync();

            if (dador == null)
            {
                return(NotFound());
            }

            return(View(dador));
        }