public ActionResult ListAuthors() { using (var pubs = new PubsEntities()) { var query = pubs.Authors .Select(a => new AuthorOverview { AuthorId = a.AuthorId, AuthorName = a.AuthorFirstName + " " + a.AuthorLastName, Phone = a.Phone, State = a.State, Contract = a.Contract }); var vm = new AuthorOverviewListViewModel { Authors = query.ToArray() }; return(View(vm)); } }
public ActionResult ListAuthors() { using (var pubs = new PubsEntities()) { var query = pubs.Authors .Select(a => new AuthorOverview { AuthorId = a.AuthorId, AuthorName = a.AuthorFirstName + " " + a.AuthorLastName, Phone = a.Phone, State = a.State, Contract = a.Contract }); var vm = new AuthorOverviewListViewModel { Authors = query.ToArray() }; return View(vm); } }