public ActionResult SysRoleProgram_Create(string SRRowid, ViewModel_RolePrograms roleprogram) { if (roleprogram != null && ModelState.IsValid) { var target = new SysRoleProgram(); target.SRPRowid = Guid.NewGuid().ToString(); target.SRRowid = SRRowid; target.SPRowid = roleprogram.SPRowid; target.SRPActive = roleprogram.SRPActive; target.SRPDisplaySeq = roleprogram.SRPDisplaySeq; db.SysRoleProgram.Add(target); db.SaveChanges(); //roleprogram.SRPRowid = target.SRPRowid; } return(Json(new[] { roleprogram }.ToDataSourceResult(new DataSourceRequest(), ModelState))); }
public ActionResult SysRoleProgram_Destroy([DataSourceRequest] DataSourceRequest request, SysRoleProgram roleprogram) { if (ModelState.IsValid) { var entity = new SysRoleProgram { SRPRowid = roleprogram.SRPRowid, SRPActive = roleprogram.SRPActive, SRPDisplaySeq = roleprogram.SRPDisplaySeq, SRRowid = roleprogram.SRRowid, SPRowid = roleprogram.SPRowid }; db.SysRoleProgram.Attach(entity); db.SysRoleProgram.Remove(entity); db.SaveChanges(); } return(Json(new[] { roleprogram }.ToDataSourceResult(request, ModelState))); }
public ActionResult SysRoleProgram_Update([DataSourceRequest] DataSourceRequest request, SysRoleProgram roleprogram) { if (ModelState.IsValid) { var entity = new SysRoleProgram { SRPRowid = roleprogram.SRPRowid, SRPActive = roleprogram.SRPActive, SRPDisplaySeq = roleprogram.SRPDisplaySeq, SRRowid = roleprogram.SRRowid, SPRowid = roleprogram.SPRowid }; db.SysRoleProgram.Attach(entity); db.Entry(entity).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(Json(new[] { roleprogram }.ToDataSourceResult(request, ModelState))); }