Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
if I set a breakpoint on this method and go to localhost:1234/api/employee, the breakpoint will be hit. If I try to do localhost:1234/api/employee/SOME_ID it'll 404. What am I overlooking here?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web.Http;
using MyApp.ElasticData;
using MyApp.Models;
namespace MyApp.Controllers
public class EmployeeController : BaseController
public async Task<Employee> GetByPernr(string id = null)
var app = new ElasticEvents();
var emp = await app.GetElasticDataById(id);
var empData = new Employee
FirstName = emp.FirstName,
LastName = emp.LastName,
NtId = emp.NtId
return empData;
public static void RegisterRoutes(RouteCollection routes)
routes.LowercaseUrls = true;
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment