TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Luis Alberto Delgado de la Flor
NA
127
23.1k
Using viewModel error: Cannot implicitly convert type
Jun 23 2017 3:56 AM
Hello,
Direct error. I have a ViewModel class called StoreLocationViewModel. Here is the definition.
public
class
StoreLocationViewModel
{
public
Store Stores {
get
;
set
; }
public
List<Department> Departments {
get
;
set
; }
}
Inside the Controller I'm trying to initialize the ViewModel
public
async Task<IActionResult> Index()
{
var viewModel =
new
StoreLocationViewModel();
viewModel.Stores = _context.Stores;
However I get this error:
Cannot implicitly convert type 'Microsoft.EntityFrameworkCore.DbSet<Application.Models.Store>' into 'Applications.Models.Store'.
This is the first time encountering this error and it's too specific in order to find documentation online. Can someone please explain me what does it mean?. Thanks in advance!
Reply
Answers (
3
)
pressing the enter to add row of table in jquary.
how to create dynamic in _layout page in asp.net mvc 5