public ActionResult SHCDept_Destroy([DataSourceRequest] DataSourceRequest request, SysHCDept ddata) { if (ModelState.IsValid) { var entity = new SysHCDept { SHDRowid = ddata.SHDRowid }; db.SysHCDept.Attach(entity); db.SysHCDept.Remove(entity); db.SaveChanges(); } return(Json(new[] { ddata }.ToDataSourceResult(request, ModelState))); }
public ActionResult SHCDept_Create(string sCBDRowid, ViewModel_SysHCDept cdata) { if (cdata != null && ModelState.IsValid) { var target = new SysHCDept(); target.SHDRowid = Guid.NewGuid().ToString(); target.CBDRowid = sCBDRowid; target.SHDCode = cdata.SHDCode; target.SHDDisplayOrder = cdata.SHDDisplayOrder; db.SysHCDept.Add(target); db.SaveChanges(); } return(Json(new[] { cdata }.ToDataSourceResult(new DataSourceRequest(), ModelState))); }
public ActionResult SHCDept_Update([DataSourceRequest] DataSourceRequest request, SysHCDept udata) { if (ModelState.IsValid) { var entity = new SysHCDept { SHDRowid = udata.SHDRowid, CBDRowid = udata.CBDRowid, SHDCode = udata.SHDCode, SHDDisplayOrder = udata.SHDDisplayOrder }; db.SysHCDept.Attach(entity); db.Entry(entity).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(Json(new[] { udata }.ToDataSourceResult(request, ModelState))); }