//queryの条件に一致するIEnumerable<Keyword>を返す
        public IEnumerable <Keyword> Find(Func <IQueryable <Keyword>, IQueryable <Keyword> > query)
        {
            // TODO: DBプログラミング講座で実装
            List <Keyword> keywords = new List <Keyword>();

            using (var context = new PhotoFrameEntities())
            {
                foreach (var table_Keyword in context.Table_Keyword)
                {
                    keywords.Add(Convert_MKey_to_Key(table_Keyword));
                }
                return(query(keywords.AsQueryable()));
            };
        }
        //queryの条件に一致するIEnumerable<Keyword>を返す
        public IEnumerable <Photo> Find(Func <IQueryable <Photo>, IQueryable <Photo> > query)
        {
            // TODO: DBプログラミング講座で実装
            List <Photo> photos = new List <Photo>();

            using (var context = new PhotoFrameEntities())
            {
                foreach (var table_Photo in context.Table_Photo)
                {
                    photos.Add(Convert_MPhoto_to_Photo(table_Photo));
                }
                return(query(photos.AsQueryable()));
            };
        }
 //キーワードのIdが同じものがあれば除外し、DBにキーワードを追加する
 public Keyword Store(Keyword entity)
 {
     using (var context = new PhotoFrameEntities())
     {
         IQueryable <Table_Keyword>
         query = from keyword in context.Table_Keyword
                 where keyword.Id == entity.Id
                 select keyword;
         foreach (var table_Keyword in query)
         {
             context.Table_Keyword.Remove(table_Keyword);
         }
         context.Table_Keyword.Add(Convert_Key_to_MKey(entity));
         context.SaveChanges();
         return(entity);
     }
 }
 //PhotoのIdが同じものがあれば除外し、DBにPhotoを追加する
 public Photo Store(Photo entity)
 {
     using (var context = new PhotoFrameEntities())
     {
         IQueryable <Table_Photo>
         query = from Photo in context.Table_Photo
                 where Photo.Id == entity.Id
                 select Photo;
         foreach (var table_Photo in query)
         {
             context.Table_Photo.Remove(table_Photo);
         }
         context.Table_Photo.Add(Convert_Photo_to_MPhoto(entity));
         context.SaveChanges();
         return(entity);
     }
 }