static void Main() { using (var sagan = new Sagan()) { if (sagan.Händelser.Count() == 0 && sagan.Koppling.Count() == 0 && sagan.Personer.Count() == 0 && sagan.Saker.Count() == 0) { // Kalla en seeder funktion } // Gör en sökning var saga = from koppling in sagan.Koppling join personA in sagan.Personer on koppling.Person1 equals personA.ID join händelse in sagan.Händelser on koppling.Handling equals händelse.ID join sak in sagan.Saker on koppling.Sak equals sak.ID join personB in sagan.Personer on koppling.Person2 equals personB.ID into checkNull from mottagare in checkNull.DefaultIfEmpty() select new ViewModels.QueryResult { // Skapa objekt med önskad information Person1 = personA.Namn, händelse = händelse.Namn, Sak = sak.Namn, Person2 = mottagare.Namn } ; // Skriv ut informationen foreach (var item in saga) { Console.WriteLine($"{item.Person1} {item.händelse} {item.Sak} {item.Person2}"); } } }
public Planet(Sagan.Framework.Camera camera, int radius, int levels=2) : base(name: "SaganPlanet") { this._camera = camera; this.radius = radius; this.levels = levels; this._terrainSize = 2 * this.radius; // Add a cube to center our local origin around the cube faces we will be adding this._planetCube = new SaganCube("PlanetCube"); this.AddChild(_planetCube); this._planetCube.transform.localScale = new Vector3(this._terrainSize, this._terrainSize, this._terrainSize); this._planetCube.visible = false; // Add our terrain faces to the cube // If the faces are splayed out, this is how they would look: // 4 // 0 1 2 3 // 5 this.AddFace("Face 0", new Vector3(270, 0, 0), new Vector3(0, 0, -this.radius)); this.AddFace("Face 1", new Vector3(270, 270, 0), new Vector3(this.radius, 0, 0)); this.AddFace("Face 2", new Vector3(270, 180, 0), new Vector3(0, 0, this.radius)); this.AddFace("Face 3", new Vector3(270, 90, 0), new Vector3(-this.radius, 0, 0)); this.AddFace("Face 4", new Vector3(0, 270, 0), new Vector3(0, this.radius, 0)); this.AddFace("Face 5", new Vector3(0, 90, 180), new Vector3(0, -this.radius, 0)); }
private static void AddNewItem(Sagan sagan, int person1Id, int HandlingId, int SakId, int Person2Id) { //Hämta senaste ID (då databasen inte är inställd på autoincrement :( var KopplingsID = sagan.Koppling.Max(k => k.ID); //Skapa ny objekt sagan.Koppling.Add(new Models.Koppling { ID = KopplingsID, Person1 = person1Id, Handling = HandlingId, Sak = SakId, Person2 = Person2Id }); //Spara ändringen sagan.SaveChanges(); }