So, I have 3 methods in my API:
public List<FlatResponse> GetFlats()
public Flat Reserve(int id, int customerId, string service)
public List<FlatResponse> SearchFlats(double budget, double surface)
Now, somehow, for every response the API uses the GetFlats() method.
Perhaps I am using the wrong url?
To reserve flat, I use
myUrl.com/api/flats/?id=1&customerId=2&service=someservice
. To search for specific flats, I use
myUrl.com/api/flats/?budget=500&surface=30
What am I doing wrong?
EDIT:
It is possible that my project isn't structured correctly. Although it works in another API.
My Flatcontroller class
public class FlatsController : ApiController
{
public List<FlatResponse> GetFlats()
{
...
}
public Flat Reserve(int id, int customerId, string service)
{
...
}
public List<FlatResponse> SearchFlats(double budget, double surface)
{
...
}
}
The flatresponse class
public class FlatResponse
{
public int Id { get; set; }
public string Description { get; set; }
public string Street { get; set; }
public int HouseNumber { get; set; }
public int PostalCode { get; set; }
public string City { get; set; }
public double RentalPrice { get; set; }
public double Surface { get; set; }
public int ContractTime { get; set; }
public DateTime StartDate { get; set; }
public List<string> Facilities { get; set; }
public string ContactPersonName { get; set; }
public string ContactPersonEmail { get; set; }
public string ContactPersonTelephone { get; set; }
public bool Reserved { get; set; }
public string DetailUrl { get; set; }
public string ImageUrl { get; set; }
}
___Result). Where are the controller methods?