Last post Jun 05, 2020 03:53 PM by GeorgeTheCoder
Member
2 Points
30 Posts
Jun 05, 2020 03:40 PM|GeorgeTheCoder|LINK
I'm trying to get only 3 columns and it's returning me everything.
public JsonResults GetAll() { var q = _db.Cars; return Json(new { data = q .Select(x=> new Cars() { CarMake = x.Make, CarModel = x.Model }) }); }
It's returning me everything from the Cars Table, make, model, year, color, engine, etc. I only want Make and Model to be returned
Jun 05, 2020 03:53 PM|GeorgeTheCoder|LINK
Update:
Found the issue. I changed
.Select(x=> new Cars()
to
.Select(x=> new
Member
2 Points
30 Posts
Why is this returning me all columns
Jun 05, 2020 03:40 PM|GeorgeTheCoder|LINK
I'm trying to get only 3 columns and it's returning me everything.
It's returning me everything from the Cars Table, make, model, year, color, engine, etc. I only want Make and Model to be returned
Member
2 Points
30 Posts
Re: Why is this returning me all columns
Jun 05, 2020 03:53 PM|GeorgeTheCoder|LINK
Update:
Found the issue. I changed
to