// POST: api/Unit
        public ServerResponse Post([FromBody] Supplier Supplier)
        {
            var res = new ServerResponse();

            using (SupplierBL SupplierBL = new SupplierBL())
            {
                try
                {
                    res.Data = SupplierBL.SaveSupplier(Supplier);
                }
                catch (Exception ex)
                {
                    res.Success = false;
                }
            }
            return(res);
        }
Exemplo n.º 2
0
        protected void btnAddAttributeValue_Click(object sender, EventArgs e)
        {
            switch (lblType.Value)
            {
            case "attribute":
            {
                AttributeBL attributeBL = new AttributeBL();
                attributeBL.SaveAttributeValue(new AttributeValue(-1, txtAttributeValue.Text, int.Parse(lblAttributeID.Value), 0, string.Empty, 0), false);

                foreach (object control in pnlAttributes.Controls)
                {
                    if (control is customControls.AttributeControl)
                    {
                        if (((customControls.AttributeControl)control).ID == lblAttributeName.Value)
                        {
                            ((customControls.AttributeControl)control).setValues();
                        }
                    }
                }
                break;
            }

            case "supplier":
            {
                SupplierBL supplierBL = new SupplierBL();
                supplierBL.SaveSupplier(new Supplier(-1, txtAttributeValue.Text));
                loadSupplier();
                break;
            }

            case "brand":
            {
                BrandBL brandBL = new BrandBL();
                brandBL.SaveBrand(new Brand(-1, txtAttributeValue.Text));
                loadBrands();
                break;
            }
            }
            txtAttributeValue.Text = string.Empty;
        }