I have a web service which is developed in mvc c#, the purpose of the service is to retrieve and insert data to sql. All methods are using http attributes, so my question is, if all methods are using [HttpPost] and is working fine, when do i should use [HttpGet].
[HttpPost]
[Route("GetVehiculos")]
public HttpResponseMessage WSGetVehiculos()
{
VehiculosDAO vehiculosDAO = new VehiculosDAO();
List<Vehiculo> lstVehiculo = new List<Vehiculo>();
string codError = "0";
string mensaje = "";
try
{
lstVehiculo = vehiculosDAO.GetVehiculos();
mensaje = "OK";
}
catch (Exception ex)
{
codError ="1";
Log.WriteToFileLogGeneral(ex.Message);
}
return Request.CreateResponse(HttpStatusCode.OK, new { Msg = mensaje, CodError =
codError,Data= lstVehiculo } );
}
Thanks in advance