コード例 #1
0
        public HttpResponseMessage Post(CompanyCustomerView view)
        {
            var model = view.getModel();
            model.created = DateTime.UtcNow;
            model.updated = DateTime.UtcNow;
            model.enabled = true;
            model.fakeId = Guid.NewGuid();
            model = repo.createCompanyCustomer(model);
            view = new CompanyCustomerView(model);

            var response = Request.CreateResponse<CompanyCustomerView>(HttpStatusCode.Created, view);
            string uri = Url.Route(null, new { id = view.id });
            response.Headers.Location = new Uri(Request.RequestUri, uri);
            return response;
        }
コード例 #2
0
 public void Put(int id, CompanyCustomerView view)
 {
     view.id = id;
     var model = view.getModel();
     model.updated = DateTime.UtcNow;
     repo.update(model);
 }