public void Put(int id, EmployeeView view) { view.id = id; var model = view.getModel(); model.updated = DateTime.UtcNow; repo.update(model); }
public HttpResponseMessage Post(EmployeeView view) { var model = view.getModel(); model.created = DateTime.UtcNow; model.updated = DateTime.UtcNow; model.fakeId = Guid.NewGuid(); model = repo.createEmployee(model); view = new EmployeeView(model); var response = Request.CreateResponse <EmployeeView>(HttpStatusCode.Created, view); string uri = Url.Route(null, new { id = view.id }); response.Headers.Location = new Uri(Request.RequestUri, uri); return(response); }
public HttpResponseMessage Post(EmployeeView view) { var model = view.getModel(); model.created = DateTime.UtcNow; model.updated = DateTime.UtcNow; model.fakeId = Guid.NewGuid(); model = repo.createEmployee(model); view = new EmployeeView(model); var response = Request.CreateResponse<EmployeeView>(HttpStatusCode.Created, view); string uri = Url.Route(null, new { id = view.id }); response.Headers.Location = new Uri(Request.RequestUri, uri); return response; }