public PlanetDetails GetPlanet(int?id) { var planetDetails = new PlanetDetails(); planetDetails = this.dbContext.Planets.Where(p => p.Id == id).FirstOrDefault(); return(planetDetails); }
public void InsertOrUpdate(PlanetDetails planetDetails) { if (planetDetails.Id == default(int)) { // New entity this.dbContext.Planets.Add(planetDetails); } else { // Existing entity this.dbContext.Entry(planetDetails).State = System.Data.Entity.EntityState.Modified; } }