public IHttpActionResult Patch([FromODataUri] string key, Delta <CODE_SCHOOLEntity> patch) { CODE_SCHOOLService service = new CODE_SCHOOLService(); object id; if (!ModelState.IsValid) { return(BadRequest(ModelState)); } else if (patch.GetChangedPropertyNames().Contains("SCHOOLID") && patch.TryGetPropertyValue("SCHOOLID", out id) && (string)id != key) { return(BadRequest("The key from the url must match the key of the entity in the body")); } try { var query = service.GetEntity(key); patch.Patch(query); service.UpdateEntity(query); return(Updated(query)); } catch (Exception) { return(NotFound()); } }
public IHttpActionResult RecordQuery(string key) { CODE_SCHOOLService service = new CODE_SCHOOLService(); try { var query = service.GetEntity(key.ToString()); var packageEntity = query.PackageResult(); return(Json(packageEntity)); } catch (Exception) { PackageResultEntity <object> packageResultEntity = new PackageResultEntity <object>() { list = null, msg = "failed" }; return(Json(packageResultEntity)); } }