I have a table Users
that has IDCompany
and IDUserCode
as its primary key.
But when I scaffold for New->Controller, it always generates only one field (id) as key:
public class UsersController : ApiController
{
private CaiqueEntities db = new CaiqueEntities();
// GET: api/Users
public IQueryable<Users> GetUsers()
{
return db.Users;
}
// GET: api/Users/5
[ResponseType(typeof(Users))]
public IHttpActionResult GetUsers(int id)
{
Users users = db.Users.Find(id);
if (users == null)
{
return NotFound();
}
return Ok(users);
}
}
I need, the first GET to receive IDCompany
, and the second IDCompany
AND IDUser
.
Is there any way to configure VS to generate this way? Or I need to do it manually?
Already tested:
[Key]
attributes- New route
- Override
OnModelCreating
Second day testing EF tutorials.
Thanks in advance.