Exemple #1
0
        public Cart GetCart(int id)
        {
            OlShoppingBusinessLayer bll = new OlShoppingBusinessLayer();
            var d = bll.AddToCart(id);

            return(d);
        }
Exemple #2
0
        public ProductDetails Get(int id)
        {
            OlShoppingBusinessLayer bll = new OlShoppingBusinessLayer();
            var d = bll.GetDetailsOfProduct(id);

            return(d);
        }
Exemple #3
0
        public List <Products> Get(string name)
        {
            OlShoppingBusinessLayer bll = new OlShoppingBusinessLayer();
            var clst = bll.GetProductsByCategoryName(name);

            return(clst);
        }
Exemple #4
0
        public List <Products> GetByName(string name)
        {
            //Accessing data
            OlShoppingBusinessLayer bll = new OlShoppingBusinessLayer();
            var clst = bll.GetProductsByProductName(name);

            return(clst);
        }
Exemple #5
0
        public List <Home> Get()
        {
            //Accessing data using with the businneslayer
            OlShoppingBusinessLayer bll = new OlShoppingBusinessLayer();
            var clst = bll.GetAllCategories();

            return(clst);
        }
Exemple #6
0
        public HttpResponseMessage Delete(int id)
        {
            HttpResponseMessage errRes = Request.CreateErrorResponse(HttpStatusCode.OK, "Record Found");

            //Handling Exception
            try
            {
                OlShoppingBusinessLayer bll = new OlShoppingBusinessLayer();
                bll.DeleteProductById(id);
            }
            catch (Exception ex)
            {
                errRes = Request.CreateErrorResponse(HttpStatusCode.NotFound, "Id not found");
            }
            return(errRes);
        }
Exemple #7
0
        //Updating the Product
        public HttpResponseMessage put([FromBody] Products pr)
        {
            HttpResponseMessage errRes = Request.CreateErrorResponse(HttpStatusCode.OK, "Record Updated");

            //Handling Exception
            try
            {
                OlShoppingBusinessLayer bll = new OlShoppingBusinessLayer();
                bll.UpdateProductById(pr);
            }
            catch
            {
                errRes = Request.CreateErrorResponse(HttpStatusCode.NotFound, "Updation Error!!!");
            }
            return(errRes);
        }
Exemple #8
0
        //Posting the data
        public HttpResponseMessage Post([FromBody] Products pr)
        {
            HttpResponseMessage errRes = Request.CreateErrorResponse(HttpStatusCode.OK, "Record added");

            //Handling the Exception
            try
            {
                OlShoppingBusinessLayer bll = new OlShoppingBusinessLayer();
                bll.AddProduct(pr);
            }
            catch (Exception ex)
            {
                errRes = Request.CreateErrorResponse(HttpStatusCode.NotFound, "Could not insert");
            }

            return(errRes);
        }