public async Task <AddCart> GetCartItem(int cartid) { Cart cart = await _context.Cart.FindAsync(cartid); if (cart == null) { return(null); } else { AddCart cart1 = new AddCart(); cart1.carId = cart.Id; cart1.categoryId = cart.Categoryid; cart1.subCategoryId = cart.Subcategoryid; cart1.buyerId = cart.Bid; cart1.itemId = cart.Itemid; cart1.price = cart.Price; cart1.itemName = cart.Itemname; cart1.description = cart.Description; cart1.stockno = cart.Stockno; cart1.remarks = cart.Remarks; cart1.imageName = cart.Imagename; return(cart1); } }
public async Task <bool> AddToCart(AddCart cart) { Cart cart1 = new Cart(); if (cart != null) { cart1.Id = cart.carId; cart1.Categoryid = cart.categoryId; cart1.Subcategoryid = cart.subCategoryId; cart1.Bid = cart.buyerId; cart1.Itemid = cart.itemId; cart1.Price = cart.price; cart1.Itemname = cart.itemName; cart1.Description = cart.description; cart1.Stockno = cart.stockno; cart1.Remarks = cart.remarks; cart1.Imagename = cart.imageName; } _context.Cart.Add(cart1); var buyercart = await _context.SaveChangesAsync(); if (buyercart > 0) { return(true); } else { return(false); } }
protected void Page_Load(object sender, EventArgs e) { platform = Request.QueryString["pid"]; /* if (platform == "ALL") * { * Session.Remove("platform"); * if(Session["page"] != null) * Response.Redirect(Session["Page"]+".aspx"); * else * Response.Redirect("AllGames.aspx"); * * } * else * { * Session.Add("platform", platform); * }*/ if (platform == "ALL") { Response.Redirect("TopGames.aspx"); } Session.Remove("Page"); Session.Add("pageadder", "TopGames"); Session.Add("url", "TopGamesPlatform.aspx" + Request.QueryString["pid"]); cart = new AddCart(); wish = new AddWishlist(); }
/// <summary> /// add cart /// </summary> /// <param name="userId"></param> /// <param name="showCartModel"></param> /// <returns></returns> public AddCart AddCart(int userId, ShowCartModel showCartModel) { try { DatabaseConnection databaseConnection = new DatabaseConnection(this.configuration); List <StoredProcedureParameterData> paramList = new List <StoredProcedureParameterData>(); paramList.Add(new StoredProcedureParameterData("@UserId", userId)); paramList.Add(new StoredProcedureParameterData("@BookId", showCartModel.BookId)); paramList.Add(new StoredProcedureParameterData("@IsUsed", false)); paramList.Add(new StoredProcedureParameterData("@CreatedDate", DateTime.Now)); paramList.Add(new StoredProcedureParameterData("@ModifiedDate", DateTime.Now)); DataTable table = databaseConnection.StoredProcedureExecuteReader("AddCart", paramList); var cartData = new AddCart(); foreach (DataRow dataRow in table.Rows) { cartData = new AddCart(); cartData.CartId = (int)dataRow["Id"]; cartData.UserId = Convert.ToInt32(dataRow["UserId"].ToString()); cartData.BookId = Convert.ToInt32(dataRow["BookId"].ToString()); cartData.IsUsed = Convert.ToBoolean(dataRow["IsUsed"].ToString()); cartData.CreatedDate = Convert.ToDateTime(dataRow["CreatedDate"]); cartData.ModifiedDate = Convert.ToDateTime(dataRow["ModifiedDate"]); } return(cartData); } catch (Exception exception) { throw new Exception(exception.Message); } }
//shop item public Checkout ShopProduct() { AddCart.Click(); System.Threading.Thread.Sleep(5000); PropertiesCollection.Driver.FindElement(By.Id("add-to-cart-button-4")).Click(); ShoppingCart.Click(); Console.WriteLine("Click on shopping cart"); return(new Checkout()); }
private void Btn_Click(object sender, EventArgs e) { Button btn = (Button)sender; int id = int.Parse(btn.Name.Split('_')[1]); AddCart cart = new AddCart(Produto.Find(id)); cart.Show(); }
public async Task <IActionResult> GetCartItem(int cartid) { AddCart cart1 = await _iitemManager.GetCartItem(cartid); if (cart1 != null) { return(Ok(cart1)); } else { return(Ok("Cart is Null")); } }
public async Task <AddCart> GetCartItem(int cartid) { AddCart cart = await _iitemRepository.GetCartItem(cartid); if (cart != null) { return(cart); } else { return(null); } }
public async Task <IActionResult> AddToCart(AddCart cart) { bool cart1 = await _iitemManager.AddToCart(cart); if (cart1) { return(Ok()); } else { return(Ok("Item not added")); } }
public async Task <bool> AddToCart(AddCart cart) { bool buyercart = await _iitemRepository.AddToCart(cart); if (buyercart) { return(true); } else { return(false); } }
protected void Page_Load(object sender, EventArgs e) { Session.Remove("Search"); if (Session["Platform"] != null) { if(Session["Platform"] != "All") Response.Redirect("TopGamesPlatform.aspx?pid=" + (String)Session["Platform"]); } Session.Add("page","TopGames"); // iterator = 0; cart = new AddCart(); wish = new AddWishlist(); Session.Add("url", "TopGamesPlatform.aspx"); }
public static async Task <AddCart> AddToCart(Dictionary <string, string> data) { AddCart addCart = new AddCart(); using (HttpClient httpClient = new HttpClient(new NativeMessageHandler())) { var jsonData = new StringContent(JsonConvert.SerializeObject(data), Encoding.UTF8, "application/json"); var response = await httpClient.PostAsync(Config.AddToCart, jsonData); var json = await response.Content.ReadAsStringAsync(); addCart = JsonConvert.DeserializeObject <AddCart>(json); } return(addCart); }
protected void Page_Load(object sender, EventArgs e) { platform = Request.QueryString["pid"]; if (platform == "ALL") Response.Redirect("NewGames.aspx"); Session.Remove("Page"); //Session.Remove("pageadder"); Session.Add("pageadder", "NewGames"); cart = new AddCart(); wish = new AddWishlist(); Session.Add("url", "NewGamesPlatform.aspx?pid=" + Request.QueryString["pid"]); }
protected void Page_Load(object sender, EventArgs e) { platform = Request.QueryString["pid"]; if (platform == "ALL") { Response.Redirect("AllGames.aspx"); } Session.Remove("Page"); Session.Add("pageadder", "AllGames"); cart = new AddCart(); wish = new AddWishlist(); Session.Add("url", "AllGamesPlatform.aspx?pid=" + Request.QueryString["pid"]); }
public async Task AddToCart_Successfull(int cartId, int buyerId, int itemid, int price, string itemName, string description, int stockno, string remarks, string imageName) { try { var cart = new AddCart { cartId = cartId, buyerId = buyerId, itemId = itemid, price = price, itemName = itemName, description = description, stockno = stockno, remarks = remarks, imageName = imageName }; var result = await iitemRepository.AddToCart(cart); Assert.NotNull(result); } catch (Exception e) { Assert.Fail(e.Message); } }
protected void Page_Load(object sender, EventArgs e) { Session.Remove("Search"); if (Session["Platform"] != null) { if (Session["Platform"] != "All") { Response.Redirect("TopGamesPlatform.aspx?pid=" + (String)Session["Platform"]); } } Session.Add("page", "TopGames"); // iterator = 0; cart = new AddCart(); wish = new AddWishlist(); Session.Add("url", "TopGamesPlatform.aspx"); }
public async Task GetCart_Successfull(int cartId) { try { AddCart cart = new AddCart(); var mock = new Mock <IItemRepository>(); mock.Setup(x => x.GetCartItem(cartId)).ReturnsAsync(cart); ItemManager itemManager = new ItemManager(mock.Object); var result = await itemManager.GetCartItem(cartId); Assert.NotNull(result); } catch (Exception e) { Assert.Fail(e.Message); } }
protected void Page_Load(object sender, EventArgs e) { /* if (Session["Platform"] != null) * { * Response.Redirect("AllGamesPlatform.aspx?pid="+(String)Session["Platform"]); * } */ Session.Remove("Search"); if (Session["Platform"] != null) { Response.Redirect("AllGamesPlatform.aspx?pid=" + (String)Session["Platform"]); } Session.Add("page", "AllGames"); cart = new AddCart(); wish = new AddWishlist(); Session.Add("url", "AllGamesPlatform.aspx"); }
protected void Page_Load(object sender, EventArgs e) { platform = Request.QueryString["pid"]; string search = Request.QueryString["search"]; if (platform == "ALL") { Response.Redirect("SearchAllGames.aspx?search=" + Session["search"]); } Session.Remove("Page"); cart = new AddCart(); wish = new AddWishlist(); Session.Add("url", "SearchAllGames.aspx?search=" + Session["search"]); }
protected void Page_Load(object sender, EventArgs e) { /* if (Session["Platform"] != null) * { * Response.Redirect("AllGamesPlatform.aspx?pid="+(String)Session["Platform"]); * } */ Session.Remove("Search"); Session.Remove("platform"); if (String.IsNullOrEmpty(Page.Request.QueryString["gg_id"])) { Response.Redirect("~/Genre.aspx"); } cart = new AddCart(); wish = new AddWishlist(); Session.Add("url", "GameGenre.aspx?gg_id=" + Request.QueryString["gg_id"] + "&Name=" + Request.QueryString["Name"]); }
protected void Page_Load(object sender, EventArgs e) { /* if (Session["Platform"] != null) { Response.Redirect("AllGamesPlatform.aspx?pid="+(String)Session["Platform"]); } */ Session.Remove("Search"); Session.Remove("platform"); if (String.IsNullOrEmpty(Page.Request.QueryString["gg_id"])) { Response.Redirect("~/Genre.aspx"); } cart = new AddCart(); wish = new AddWishlist(); Session.Add("url", "GameGenre.aspx?gg_id=" + Request.QueryString["gg_id"] + "&Name=" + Request.QueryString["Name"]); }
public async Task AddToCart_Successfull(int cartId, int buyerId, int itemid, int price, string itemName, string description, int stockno, string remarks, string imageName) { try { var cart = new AddCart { cartId = cartId, buyerId = buyerId, itemId = itemid, price = price, itemName = itemName, description = description, stockno = stockno, remarks = remarks, imageName = imageName }; var mock = new Mock <IItemRepository>(); mock.Setup(x => x.AddToCart(cart)).ReturnsAsync(true); ItemManager itemManager = new ItemManager(mock.Object); var result = await itemManager.AddToCart(cart); Assert.NotNull(result); } catch (Exception e) { Assert.Fail(e.Message); } }
protected void Page_Load(object sender, EventArgs e) { /* if (Session["Platform"] != null) * { * Response.Redirect("AllGamesPlatform.aspx?pid="+(String)Session["Platform"]); * } */ string search = Request.QueryString["search"]; if (Session["Platform"] != null) { Response.Redirect("SearchAllGamesPlatform.aspx?pid=" + (String)Session["platform"] + "&search=" + Session["search"]); } //Session.Add("page", "SearchAllGames"); cart = new AddCart(); wish = new AddWishlist(); Session.Add("url", "SearchAllGames.aspx?search=" + Session["search"]); }
protected void Page_Load(object sender, EventArgs e) { /* if (Session["Platform"] != null) { Response.Redirect("AllGamesPlatform.aspx?pid="+(String)Session["Platform"]); } */ string search = Request.QueryString["search"]; if (Session["Platform"] != null ) { Response.Redirect("SearchAllGamesPlatform.aspx?pid=" + (String)Session["platform"] + "&search=" + Session["search"]); } //Session.Add("page", "SearchAllGames"); cart = new AddCart(); wish = new AddWishlist(); Session.Add("url", "SearchAllGames.aspx?search=" + Session["search"]); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { if (Session["User"] == null) { lbl_del.Text = "Sign in to add or change your review"; btn_delete.Visible = false; } else { btn_delete.Visible = true; lbl_del.Text = ""; } cart = new AddCart(); wish = new AddWishlist(); } game_rating = 0; game_review = 0; con2 = new MyConnection(); u_id = Convert.ToInt16(Session["userid"]); g_id = Convert.ToInt16(Request.QueryString["gid"]); GetReview(); GetGameReview(); rev = new AddReview(); if (Exist) { lbl_del.Text = ""; } else { lbl_del.Text = ""; } Session.Add("url", "Details.aspx?gid=" + g_id); }
public List <AddCart> GetAllCart(int userId) { try { DatabaseConnection databaseConnection = new DatabaseConnection(this.configuration); List <StoredProcedureParameterData> paramList = new List <StoredProcedureParameterData>(); paramList.Add(new StoredProcedureParameterData("@UserId", userId)); DataTable table = databaseConnection.StoredProcedureExecuteReader("GetAllCart", paramList); var cartData = new AddCart(); List <AddCart> cartLists = new List <AddCart>(); foreach (DataRow dataRow in table.Rows) { cartData = new AddCart(); cartData.CartId = (int)dataRow["Id"]; cartData.UserId = Convert.ToInt32(dataRow["UserId"].ToString()); cartData.BookId = Convert.ToInt32(dataRow["BookId"].ToString()); cartData.IsUsed = Convert.ToBoolean(dataRow["IsUsed"].ToString()); cartData.CreatedDate = Convert.ToDateTime(dataRow["CreatedDate"]); cartData.ModifiedDate = Convert.ToDateTime(dataRow["ModifiedDate"]); cartLists.Add(cartData); } if (cartLists.Count != 0) { return(cartLists); } else { return(null); } } catch (Exception e) { throw new Exception(e.Message); } }