/// <summary> /// Override base Delete because we cannot create an object set based on our TEntity, because the set is the same /// for all our different locations types /// </summary> /// <param name="ID"></param> public override void Delete(Guid ID) { ObjectSet <Ef4Location> set = Ctx.CreateObjectSet <Ef4Location>(); set.DeleteObject(set.Where(entity => entity.ID.Equals(ID)).Single()); SaveChanges(); }
public ClimbIndoor UpdateIndoor(ClimbIndoor climb) { var set = Ctx.CreateObjectSet <Climb>(); var tEntityInDB = GetIndoorClimbByID(climb.ID); set.ApplyCurrentValues(climb); SaveChanges(); return(climb); }
public override LocationIndoor Update(LocationIndoor tEntity) { tEntity.SetEmptyIfNull(e => e.Description, (e, s) => e.Description = s); tEntity.SetEmptyIfNull(e => e.NameShort, (e, s) => e.NameShort = s); tEntity.SetEmptyIfNull(e => e.SearchSupportString, (e, s) => e.SearchSupportString = s); tEntity.SetEmptyIfNull(e => e.Avatar, (e, s) => e.Avatar = s); //-- Use E.f. for most of the update ObjectSet <Ef4Location> set = Ctx.CreateObjectSet <Ef4Location>(); LocationIndoor tEntityInDB = GetByID(tEntity.ID); set.ApplyCurrentValues(tEntity); SaveChanges(); //-- Finish of with the geography type from the LocationRepository new LocationRepository().UpdateLocationGeography(tEntity.ID, tEntity.Geo); return(tEntity); }