示例#1
0
        public void Put(int id, EmployeeView view)
        {
            view.id = id;
            var model = view.getModel(repo);

            model.updated = DateTime.UtcNow;
            repo.update(model);
        }
示例#2
0
        public HttpResponseMessage Post(EmployeeView view)
        {
            var model = view.getModel(repo);

            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);
        }