I have 2 tables in the database - Customer and Product. I perform the selection by skipping the first row in the table and then getting the top two rows. The result I need to get in the List cusPod .
List<Customer> customers = db.Database.SqlQuery<Customer>("SELECT * FROM Customers ORDER BY CustomerId OFFSET 1 ROWS FETCH NEXT 2 ROWS ONLY").ToList();
List<Product> products = db.Database.SqlQuery<Product>("SELECT * FROM Products ORDER BY ProductId OFFSET 1 ROWS FETCH NEXT 2 ROWS ONLY").ToList();
var listSas = from p in products
join c in customers on p.ProductId equals c.CustomerId
select new { ProductId = p.ProductId, ProductName = p.ProductName, DateStart = p.DateStart, DateEnd = p.DateEnd, DateRegister = p.DateRegister, PriceCustomer = p.PriceCustomer, CheckPay = p.CheckPay, CustomerId = p.CustomerId, FIO = c.FIO, Email = c.Email, PhoneNumber = c.PhoneNumber };
SidebarController.cusPod = listSas.ToList();
how do I do this right?