public WishListModelClass GetWhishList(WishListModelClass cart) { try { SqlCommand sqlCommand = new SqlCommand("sp_WishList", sqlConnection); sqlCommand.CommandType = CommandType.StoredProcedure; sqlCommand.Parameters.AddWithValue("@cartId", cart.WhishListId); sqlConnection.Open(); SqlDataReader sqlDataReader = sqlCommand.ExecuteReader(); while (sqlDataReader.Read()) { cart.BookId = Convert.ToInt32(sqlDataReader["Quantity"]); cart.WhishListId = Convert.ToInt32(sqlDataReader["TotalPrice"]); } return(cart); } catch (Exception e) { throw new Exception("Value is not able to read" + e); } finally { sqlConnection.Close(); } }
//[Route("Addwhis")] public IActionResult DeleteWhishList(WishListModelClass whis) { var userResult = this.whish.DeleteWhishList(whis); try { if (userResult != null) { return(this.Ok(new Response(HttpStatusCode.OK, "The Data", userResult))); } return(this.NotFound(new Response(HttpStatusCode.NotFound, " Data Not Found", userResult))); } catch (Exception) { return(this.BadRequest(new Response(HttpStatusCode.BadRequest, "List of data not displayed", null))); } }
public WishListModelClass AddWhishList(WishListModelClass whis) { try { SqlCommand sqlCommand = new SqlCommand("sp_AddWishList", sqlConnection); sqlCommand.Parameters.AddWithValue("@Bookid", whis.BookId); sqlConnection.Open(); sqlCommand.ExecuteNonQuery(); sqlConnection.Close(); return(whis); } catch (Exception e) { throw new Exception("WishList not Details Added" + e); } finally { sqlConnection.Close(); } }
public WishListModelClass DeleteWhishList(WishListModelClass whis) { return(wishList.DeleteWhishList(whis)); }
public WishListModelClass UpdateWhishList(WishListModelClass whis) { return(wishList.UpdateWhishList(whis)); }
public WishListModelClass AddWhishList(WishListModelClass whis) { return(wishList.AddWhishList(whis)); }
public WishListModelClass GetWhishList(WishListModelClass cart) { return(wishList.GetWhishList(cart)); }