예제 #1
0
        public Customers SaveCustomer(BizCustomerViewModel customer)
        {
            Customers cust = null;

            if (customer.CusId > 0)
            {
                //推荐人不能被修改
                cust       = this.GetCustomer(customer.CusId);
                cust.State = (CustomerState)customer.State;
            }
            else
            {
                cust = new Customers();
                //cust.PromId = customer.PromId;
                cust.PromName = customer.PromName;
                cust.State    = CustomerState.Normal;
            }
            cust.CustomerName    = customer.CustomerName;
            cust.CustomerAddress = customer.CustomerAddress;
            cust.BusinessAddress = customer.BusinessAddress;
            cust.Contacts        = customer.Contacts;
            cust.Phone           = customer.Phone;
            cust.Level           = (CustomerLevel)customer.Level;

            _context.Customers.AddOrUpdate(cust);
            _context.SaveChanges();

            return(cust);
        }
예제 #2
0
        public IHttpActionResult SaveBizCustomer(BizCustomerViewModel customer)
        {
            _customer.SaveCustomer(customer);

            return(Ok(ResMessage.Success()));
        }