public async Task <IActionResult> Edit(int id, [Bind("IdTipoExame,Descricao,IDExame")] TipoDeExame tipoDeExame) { if (id != tipoDeExame.IdTipoExame) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tipoDeExame); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TipoDeExameExists(tipoDeExame.IdTipoExame)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["IDExame"] = new SelectList(_context.Exames, "IDExame", "Descricao", tipoDeExame.IDExame); return(View(tipoDeExame)); }
public async Task <IActionResult> Create([Bind("IdTipoExame,Descricao,IDExame")] TipoDeExame tipoDeExame) { if (ModelState.IsValid) { _context.Add(tipoDeExame); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["IDExame"] = new SelectList(_context.Exames, "IDExame", "Descricao", tipoDeExame.IDExame); return(View(tipoDeExame)); }
public Exame Convert(ExameDTO source, Exame destination, ResolutionContext context) { TipoDeExame tipoDeExame = _tipoDeExameServico.Obter(source.TipoDeExame.Id); StatusExame statusExame = null; Laboratorio laboratorio = _laboratorioServico.Obter(source.LaboratorioRealizouExameId.GetValueOrDefault()); Consulta consulta = _consultaServico.Obter(source.ConsultaId); if (Enum.TryParse(source.StatusExame.Id, out EStatusExame eStatusExame)) { statusExame = _statusExameServico.Obter(eStatusExame); } return(new Exame( source.Id, tipoDeExame, source.Observacao, statusExame, laboratorio, consulta, source.LinkResultadoExame)); }