예제 #1
0
        public PlanetDetails GetPlanet(int?id)
        {
            var planetDetails = new PlanetDetails();

            planetDetails = this.dbContext.Planets.Where(p => p.Id == id).FirstOrDefault();
            return(planetDetails);
        }
예제 #2
0
 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;
     }
 }