public Cart GetCart(int id) { OlShoppingBusinessLayer bll = new OlShoppingBusinessLayer(); var d = bll.AddToCart(id); return(d); }
public ProductDetails Get(int id) { OlShoppingBusinessLayer bll = new OlShoppingBusinessLayer(); var d = bll.GetDetailsOfProduct(id); return(d); }
public List <Products> Get(string name) { OlShoppingBusinessLayer bll = new OlShoppingBusinessLayer(); var clst = bll.GetProductsByCategoryName(name); return(clst); }
public List <Products> GetByName(string name) { //Accessing data OlShoppingBusinessLayer bll = new OlShoppingBusinessLayer(); var clst = bll.GetProductsByProductName(name); return(clst); }
public List <Home> Get() { //Accessing data using with the businneslayer OlShoppingBusinessLayer bll = new OlShoppingBusinessLayer(); var clst = bll.GetAllCategories(); return(clst); }
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); }
//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); }
//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); }