モデルの戻り型IEnumerable<>に問題があり、理解を深めようとしています。
モデルビューがあります:
public class Photoview
{
public int IdPhoto { get; set; }
public DateTime Date { get; set; }
public string Nom { get; set; }
public int Category { get; set; }
public string Lien { get; set; }
public bool Actif { get; set; }
public string Description { get; set; }
}
データベースからデータを取得するモデル:
public IEnumerable<Photoview> GetAllPhotos()
{
var a = from o in _ajAentities.Photos
select o;
return a.ToList();
}
ただし、コンパイルエラーが発生しています:タイプGeneric.Listをに変換できません
データベースのテーブルは次のとおりです。
id_photo int Unchecked
date smalldatetime Checked
nom nvarchar(250) Checked
categorie int Checked
lien nvarchar(250) Checked
actif bit Checked
description nvarchar(800) Checked
私の質問は次のとおりです。GetAllPhotos()のLinqクエリをIEnumerable <>タイプとして返すことができるようにするにはどうすればよいですか?
ありがとう