public ActionResult PrtPrjDestroy([DataSourceRequest] DataSourceRequest request, PrtPrjsView project) { if (project != null) { PrtPrj d = _db.PrtPrjs.First(o => o.Id == project.Id); _db.PrtPrjs.Remove(d); _db.SaveChanges(); } return(Json(new[] { project }.ToDataSourceResult(request, ModelState))); }
public ActionResult PrtPrjCreate([DataSourceRequest] DataSourceRequest request, PrtPrjsView project, Guid id1) { PrtPrj prt = new PrtPrj(); prt.Id = Guid.NewGuid(); prt.ProtocolId = id1; prt.ProjectId = project.ProjectId.Value; _db.PrtPrjs.Add(prt); _db.SaveChanges(); var result = _db.PrtPrjsViews.First(o => o.Id == prt.Id); return(Json(new[] { result }.ToDataSourceResult(request))); }