示例#1
0
        public HttpResponseMessage Put([FromBody] CustomerBO customer)
        {
            CustomerRepository repo = new CustomerRepository();



            //Data.customer _customer = new Data.customer();
            //_customer.custid = customer.CustId;
            //_customer.custname = customer.CustName;
            //_customer.creditstatus = customer.CreditStatus;
            //_customer.creditlimit = customer.CreditLimit;
            //_customer.achrequired = customer.achrequired;
            //_customer.paymentterms = customer.paymentterms;
            //_customer.customergroup = customer.CustomerGroup;
            //_customer.custkey = customer.CustomerKey;

            if (customer.Address != null)
            {
                //var custaddress = new Data.address()
                //{
                //    addrkey = customer.Address.AddrKey,
                //    address1 = customer.Address.Address1,
                //    address2 = customer.Address.Address2,
                //    city = customer.Address.City,
                //    state = customer.Address.State,
                //    country = customer.Address.Country,
                //    zipcode = customer.Address.Zip,
                //    email = customer.Address.Email,
                //    email2 = customer.Address.Email2,
                //    fax = customer.Address.Fax,
                //    phone =customer.Address.Phone,
                //    phone2 = customer.Address.Phone2,
                //    website =customer.Address.Website,
                //    addrname = customer.CustName
                //};
                //bool updated = new AddressRepository().Update(custaddress);

                AddressDL addr    = new AddressDL();
                bool      updated = addr.UpdateAddress(customer.Address);
            }
            //  bool result= repo.Update(_customer);
            bool result = cusObj.updateCustomer(customer);

            if (result)
            {
                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError));
            }
        }
        public HttpResponseMessage Put([FromBody] CompanyDetailBO company)
        {
            if (company.Address != null)
            {
                AddressDL addr    = new AddressDL();
                bool      updated = addr.UpdateAddress(company.Address);
            }
            bool result = DL.updateCompany(company);

            if (result)
            {
                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError));
            }
        }