How to get specific field(s) from database?

public class UserController : ApiController { UserSampleEntities entities = new UserSampleEntities(); // GET api/<controller> [Route("api/User")] public IEnumerable<user> Get() { { return entities.users; } } } This returns the json with all the entries in the database with all its properties. How do I filter such that I can obtain a json for only specific properties? … Read more

How to dynamically add items from different entities to lists in ASP.NET Core MVC

This is my first experience with lists in general and I have kinda complex scenario. I want to add an object of type Story that has a list of Sentences that can be added dynamically. Sentence has a one-to-one relationship with Image and another one-to-one relationship with Audio (that are optional to add). I managed to add the sentences list to the database along with the story object. But I have no idea where to start with the other two entities.