public HttpResponseMessage Post(Customer customer)
        {
            session.Store(customer);
            session.SaveChanges();

            HttpResponseMessage response = Request.CreateResponse<Customer>(HttpStatusCode.OK, customer);

            return response;
        }
コード例 #2
0
        public void UpdateCustomer(Customer customer)
        {
            if (string.IsNullOrWhiteSpace(customer.Id)) throw new ArgumentNullException("Customer Id can not be null");

            Customer cust = session.Load<Customer>(customer.Id);
            cust.Name = customer.Name;
            cust.Money = customer.Money;

            session.SaveChanges();

            Clients.customerUpdated(customer);
        }
コード例 #3
0
 public void AddCustomer(Customer customer)
 {
     Clients.customerAdded(customer);
 }