public ActionResult Create(Medico collection)
 {
     try
     {
         banco.AddToMedico(collection);
         banco.SaveChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
 public ActionResult Delete(int id, Medico collection)
 {
     try
     {
         Medico accountEdited = banco.Medico.Single(a => a.CodMed == id);
         banco.DeleteObject(accountEdited);
         banco.SaveChanges();
         return RedirectToAction("Index");
     }
     catch
     {
         return View();
     }
 }
 /// <summary>
 /// Create a new Medico object.
 /// </summary>
 /// <param name="codMed">Initial value of the CodMed property.</param>
 public static Medico CreateMedico(global::System.Int32 codMed)
 {
     Medico medico = new Medico();
     medico.CodMed = codMed;
     return medico;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the Medico EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMedico(Medico medico)
 {
     base.AddObject("Medico", medico);
 }
 public ActionResult Edit(int id, Medico collection)
 {
     try
     {
         Medico accountEdited = banco.Medico.Single(a => a.CodMed == id);
         TryUpdateModel(accountEdited);
         banco.SaveChanges();
         return RedirectToAction("Details", new { id = id });
     }
     catch
     {
         return View();
     }
 }
Пример #6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Medico EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToMedico(Medico medico)
 {
     base.AddObject("Medico", medico);
 }