Ejemplo n.º 1
0
        public void Put(int id, EmployeeView view)
        {
            view.id = id;
            var model = view.getModel();

            model.updated = DateTime.UtcNow;
            repo.update(model);
        }
Ejemplo n.º 2
0
        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 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;
        }