public ActionResult SysMedicalGroupHospital_Create(string MGRowid, ViewModel_MedicalGroupHospitals sysMedicalGroupHospitals) { if (sysMedicalGroupHospitals != null && ModelState.IsValid) { var target = new SysMedicalGroupHospital(); target.MGHRowid = Guid.NewGuid().ToString(); target.MGRowid = MGRowid; target.HospRowid = sysMedicalGroupHospitals.HospRowid; target.MGHDisplaySeq = sysMedicalGroupHospitals.MGHDisplaySeq; db.SysMedicalGroupHospital.Add(target); db.SaveChanges(); sysMedicalGroupHospitals.MGHRowid = target.MGHRowid; } return(Json(new[] { sysMedicalGroupHospitals }.ToDataSourceResult(new DataSourceRequest(), ModelState))); }
public ActionResult SysMedicalGroupHospital_Destroy([DataSourceRequest] DataSourceRequest request, SysMedicalGroupHospital sysMedicalGroupHospital) { if (ModelState.IsValid) { var entity = new SysMedicalGroupHospital { MGHRowid = sysMedicalGroupHospital.MGHRowid //MGRowid = sysMedicalGroupHospital.MGRowid, //HospRowid = sysMedicalGroupHospital.HospRowid, //MGHDisplaySeq = sysMedicalGroupHospital.MGHDisplaySeq }; db.SysMedicalGroupHospital.Attach(entity); db.SysMedicalGroupHospital.Remove(entity); db.SaveChanges(); } return(Json(new[] { sysMedicalGroupHospital }.ToDataSourceResult(request, ModelState))); }
public ActionResult SysMedicalGroupHospital_Update([DataSourceRequest] DataSourceRequest request, SysMedicalGroupHospital sysMedicalGroupHospital) { if (ModelState.IsValid) { var entity = new SysMedicalGroupHospital { MGHRowid = sysMedicalGroupHospital.MGHRowid, MGRowid = sysMedicalGroupHospital.MGRowid, HospRowid = sysMedicalGroupHospital.HospRowid, MGHDisplaySeq = sysMedicalGroupHospital.MGHDisplaySeq }; db.SysMedicalGroupHospital.Attach(entity); db.Entry(entity).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(Json(new[] { sysMedicalGroupHospital }.ToDataSourceResult(request, ModelState))); }