Ejemplo n.º 1
0
        // GET api/mccomputers
        public string Get()
        {
            //converting to the json
            var json = JsonConvert.SerializeObject(MasterImplementation.GetAllProducts());

            return(json);
        }
Ejemplo n.º 2
0
        // POST api/mccomputers
        public void Post(string name, string Description, int qty, float unitprice)
        {
            Mc_Products products = new Mc_Products();

            products.productID          = MasterImplementation.AutoIDGenarator("mc_product");
            products.productName        = name;
            products.productDescription = Description;
            products.productQty         = qty;
            products.productUnitPrice   = unitprice;
            if (MasterImplementation.AddProducts(products))
            {
                string jsonmessage = @"{  
                    'Message': true  
                }";

                var json = JsonConvert.SerializeObject(jsonmessage);
                Console.WriteLine(json);
            }
            else
            {
                string jsonmessage = @"{  
                    'Message': false  
                }";

                var json = JsonConvert.SerializeObject(jsonmessage);
                Console.WriteLine(json);
            }
        }
Ejemplo n.º 3
0
 public McComputersController()
 {
     McComputersMaster = new MasterImplementation();
 }