public static void Save(Phylum phylum) { using (var db = new FloraModel()) { db.Phylums.AddOrUpdate(phylum); db.SaveChanges(); } }
public static void Save(Photo photo) { using (var db = new FloraModel()) { db.Photos.AddOrUpdate(photo); db.SaveChanges(); } }
public static void SaveKingdom(Kingdom kingdom) { using (var db = new FloraModel()) { db.Kingdoms.AddOrUpdate(kingdom); db.SaveChanges(); } }
public static void Save(Order order) { using (var db = new FloraModel()) { db.Orders.AddOrUpdate(order); db.SaveChanges(); } }
public static void Save(Genus genus) { using (var db = new FloraModel()) { db.Genera.AddOrUpdate(genus); db.SaveChanges(); } }
public static void Save(Family family) { using (var db = new FloraModel()) { db.Families.AddOrUpdate(family); db.SaveChanges(); } }
public static void Save(Classe classe) { using (var db = new FloraModel()) { db.Classes.AddOrUpdate(classe); db.SaveChanges(); } }
public static void Save(Species species) { using (var db = new FloraModel()) { db.Specieses.AddOrUpdate(species); db.SaveChanges(); } }
public static bool IsExist(string name) { using (var db = new FloraModel()) { try { db.Kingdoms.Single(k => k.Name == name); return(true); } catch (Exception) { db.Kingdoms.Add(new Kingdom { Name = name }); db.SaveChanges(); return(false); } } }
public void Save(SpeciesSelected speciesSelected) { //Kingdom.SaveKingdom(speciesSelected.Kingdom); //Phylum.Save(speciesSelected.Phylum); //Classe.Save(speciesSelected.Classe); //Order.Save(speciesSelected.Order); //Family.Save(speciesSelected.Family); //Genus.Save(speciesSelected.Genus); //Species.Save(speciesSelected.Species); //Photo.Save(speciesSelected.Photo); using (var db = new FloraModel()) { db.Kingdoms.AddOrUpdate(speciesSelected.Kingdom); db.Phylums.AddOrUpdate(speciesSelected.Phylum); db.Classes.AddOrUpdate(speciesSelected.Classe); db.Orders.AddOrUpdate(speciesSelected.Order); db.Families.AddOrUpdate(speciesSelected.Family); db.Genera.AddOrUpdate(speciesSelected.Genus); db.Specieses.AddOrUpdate(speciesSelected.Species); db.Photos.AddOrUpdate(speciesSelected.Photo); db.SaveChanges(); } }