Hello Team,
Please am having this error, kindly assist.
Additional information: LINQ to Entities does not recognize the method 'System.String ToString()' method, and this method cannot be translated into a store expression.
public ActionResult Room() { RoomViewModel objRoomViewModel = new RoomViewModel();
List<SelectListItem> bookingStatusList = objHotelDbEntities.BookingStatus .Select(obj => new SelectListItem() { Text = obj.BookingStatus, Value = Convert.ToInt32(obj.BookingStatusId).ToString(), Selected = false }).ToList(); List<SelectListItem> roomTypeList = objHotelDbEntities.RoomTypes .Select(obj => new SelectListItem() { Text = obj.RoomTypeName, Value = Convert.ToInt32(obj.RoomTypeId).ToString(), Selected = false }).ToList(); objRoomViewModel.ListOfBookingStatus = bookingStatusList; objRoomViewModel.ListOfRoomRtype = roomTypeList; return View(objRoomViewModel);
}