I am wondering why I can not make casting in my ViewModel`s constructor:
public BookingsViewModel()
{
    IEnumerable<Booking> bookingsDB = repository.GetBookings();
    model = bookingsDB; //exception
}
It throws me an exception:
Cannot implicitly convert type
System.Collections.Generic.IEnumerable<Library2.Models.Booking>toLibrary2.Models.Bookings. An explicit conversion exists (are you missing a cast?)
When GetBookings() looks like that:
public IEnumerable<Booking> GetBookings()
{
    var bookings = context.Bookings.
            Include(i => i.Book).
            Include(i => i.Reader).
            AsEnumerable().
            ToList();
    return bookings;
}
And Bookings model like that:
public class Bookings : IEnumerable<Booking>
{
    private List<Booking> bookingList = new List<Booking>();
    public void AddBooking(Booking booking)
    {
        bookingList.Add(booking);
    }
    public bool DeleteBooking(Booking booking)
    {
        return bookingList.Remove(booking);
    }
    public int BookingList
    {
        get
        {
            return bookingList.Count;
        }
    }
    public Booking this[int index]
    {
        get
        {
            return bookingList[index];
        }
    }
    public IEnumerator<Booking> GetEnumerator()
    {
        return bookingList.GetEnumerator();
    }
    IEnumerator IEnumerable.GetEnumerator()
    {
        return GetEnumerator();
    }
}
Where is the problem  if Bookings implements IEnumerable<Booking>? How to solve the problem?
 
     
     
     
     
    