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