Nowość .NET Core..Net Core Web API
Co robię źle? Tu jest mój kontroler
[Route("api/[controller]")]
public class customerController : Controller
{
// GET: api/values
//[HttpGet]
//public IEnumerable<string> Get()
//{
// return new string[] { "value1", "value2" };
//}
// GET api/values/5
[HttpGet("{id}")]
public customer Get(int id)
{
var repo = new customerRepository();
return repo.GetCustomerOnPhone(id);
}
}
jestem w stanie połączyć się z API z tego adresu URL
http://localhost:51375/api/customer/8172858817
I hit przerwania w metodzie GET, ale Id jest zawsze zero. Nie mogę uzyskać metody odczytu wartości przekazywanej z adresu URL.
Wszelkie sugestie?
Max int jest '2147483647' Twoja wartość jest zbyt duża. zmień na 'long' – Nkosi
Lub użyj Guid dla Id's – Antoshjke