public ActionResult DeleteConfirmed(int id) { Anaminese anaminese = db.Anaminese.Find(id); db.Anaminese.Remove(anaminese); db.SaveChanges(); return(RedirectToAction("Index")); }
protected override void OnModelCreating(DbModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); // cria o banco com code frist Paciente.Map(modelBuilder); // chama o mapeamento da classe Paciente Agendamento.Map(modelBuilder); // chama o mapeamento da classe Agendamento Anaminese.Map(modelBuilder); // chama o mapeamento da classe Anaminese }
public ActionResult Edit([Bind(Include = "Id,Sintomas,DoençasAnteriores,PartesCorpo")] Anaminese anaminese) { if (ModelState.IsValid) { db.Entry(anaminese).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(anaminese)); }
public ActionResult Create([Bind(Include = "Id,Sintomas,DoençasAnteriores,PartesCorpo")] Anaminese anaminese) { if (ModelState.IsValid) { db.Anaminese.Add(anaminese); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(anaminese)); }
// GET: Anaminese/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Anaminese anaminese = db.Anaminese.Find(id); if (anaminese == null) { return(HttpNotFound()); } return(View(anaminese)); }
static void Main(string[] args) { Console.WriteLine("Criando Passiente: "); Paciente paciente = new Paciente(); paciente.Codigo = 985; paciente.Nome = "Pedrin"; paciente.CPF = "000.000.000-00"; paciente.Senha = "698"; paciente.DataDeNascimento = DateTime.Now; pacienteRepository.Save(paciente); Console.WriteLine("Criando Agendamento: "); Agendamento agendamento = new Agendamento(); agendamento.PacienteId = paciente.IdPaciente; agendamento.DataConsulta = DateTime.Now; agendamento.NomeProcedimento = "Consulta"; var horario = "22:48"; var horarios = horario.Split(':'); agendamento.Horario = new DateTime( agendamento.DataConsulta.Year, // Ano agendamento.DataConsulta.Month, // Mes agendamento.DataConsulta.Day, // dia Convert.ToInt32(horarios[0]), // horas Convert.ToInt32(horarios[1]), // minutos 0 // segundos ); Console.WriteLine("Criando Anaminese: "); Anaminese anaminese = new Anaminese(); anaminese.Sintoma = "dor de cabeça"; anaminese.DoencaExistente = "nenhuma"; anaminese.PartesCorpo = EnumPartesCorpos.Cabeça; agendamento.Anaminese = anaminese; agendamentoRepository.Save(agendamento); Console.ReadKey(); }
public IHttpActionResult PutAnaminese(Anaminese anaminese) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } service.AlterarAnaminese(anaminese); return(Ok(anaminese)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public Anaminese SalvarAnaminese(Anaminese anamineses) { try { if (anamineses == null) { throw new Exception("Não é possivel salvar uma Anaminese vazia!"); } else { repository.Save(anamineses); } return(null); } catch (Exception ex) { throw ex; } }
public Anaminese AlterarAnaminese(Anaminese a) { try { if (a == null) { throw new Exception("Não é possivel alterar a Anaminese vazia"); } else if (a.IdAnaminese != 0) { repository.UpdateAnaminese(a); return(a); } return(null); } catch (Exception ex) { throw ex; } }