public IHttpActionResult Put(int id, DLocation dLocation) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != dLocation.location_id) { return(BadRequest()); } db.Entry(dLocation).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!DLocationExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult Get(int id) { DLocation dLocation = db.DLocations.Find(id); if (dLocation == null) { return(NotFound()); } return(Ok(dLocation)); }
public IHttpActionResult Post(DLocation dLocation) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DLocations.Add(dLocation); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = dLocation.location_id }, dLocation)); }
public IHttpActionResult Delete(int id) { DLocation dLocation = db.DLocations.Find(id); if (dLocation == null) { return(NotFound()); } db.DLocations.Remove(dLocation); db.SaveChanges(); return(Ok(dLocation)); }
private void CreateBackground() { DLocation back = (DLocation)ScriptableObject.CreateInstance <DLocation>(); back.SetIdentificator(assetName); back.name = assetName; var container = (Container)AssetDatabase.LoadAssetAtPath("Assets/Paradox Engine/Database/Data/Locations.asset", typeof(Container)); container.data.Add(back); AssetDatabase.AddObjectToAsset(back, container); EditorUtility.SetDirty(container); EditorUtility.SetDirty(back); AssetDatabase.SaveAssets(); AssetDatabase.Refresh(); VNDatabaseWindow.AsignElem(back); }