是否有更短的版本将EF从linq或lambda表达式映射到View模型( Movie 这里是ViewModel),知道EF和ViewModel具有相同的字段(Id ,导演,剧情......)?
public ActionResult MovieDetails(int ID) {
using (MAKANI.Models.Entities db = new MAKANI.Models.Entities()) {
var rMovie = (from m in db.Movies
where m.ID == ID
select new Movie {
Title = m.Title,
Director = m.Director,
Plot = m.Plot,
Link = m.Link,
Starring = m.Starring
}).Single();
return View(rMovie);
}
}