public ActionResult Create(Hospital collection) { try { banco.AddToHospital(collection); banco.SaveChanges(); return RedirectToAction("Index"); } catch { return View(); } }
/// <summary> /// Create a new Hospital object. /// </summary> /// <param name="hospitalId">Initial value of the HospitalId property.</param> public static Hospital CreateHospital(global::System.Int32 hospitalId) { Hospital hospital = new Hospital(); hospital.HospitalId = hospitalId; return hospital; }
/// <summary> /// Deprecated Method for adding a new object to the Hospital EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToHospital(Hospital hospital) { base.AddObject("Hospital", hospital); }
public ActionResult Edit(int id, Hospital collection) { try { Hospital accountEdited = banco.Hospital.Single(a => a.HospitalId == id); TryUpdateModel(accountEdited); banco.SaveChanges(); return RedirectToAction("Details", new { id = id }); } catch { return View(); } }
/// <summary> /// Create a new Hospital object. /// </summary> /// <param name="codHosp">Initial value of the CodHosp property.</param> public static Hospital CreateHospital(global::System.Int32 codHosp) { Hospital hospital = new Hospital(); hospital.CodHosp = codHosp; return hospital; }