public IHttpActionResult Create(Employee employee) { if (ModelState.IsValid) { User user = new User(); JobCategory job = jobcatrepo.GetById(employee.JobId); user.UserName = employee.UserName; user.Password = employee.UserName; user.UserType = job.JobTitle; user.UserStatus = employee.Status; employeerepo.Insert(employee); userrepo.Insert(user); var emp = employeerepo.AddLink(employeerepo.GetByUserName(employee.UserName)); string url = "http://localhost:51045/api/employees/" + emp.EmployeeId; return(Created("url", emp)); } return(BadRequest(ModelState)); }