Example #1
0
        public async Task <bool> AddToCart(AddCart cart)
        {
            Cart cart1 = new Cart();

            if (cart != null)
            {
                cart1.Cartid      = cart.cartId;
                cart1.Buyerid     = 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);
            }
        }
        public async Task <bool> EditBuyerProfile(BuyerData buyer)
        {
            Buyer buyer1 = _buyerContext.Buyer.Find(buyer.buyerId);

            if (buyer1 != null)
            {
                buyer1.Username = buyer.userName;
                buyer1.Password = buyer.password;
                buyer1.Mobileno = buyer.mobileNo;
                buyer1.Email    = buyer.emailId;
                _buyerContext.Buyer.Update(buyer1);
                var user = await _buyerContext.SaveChangesAsync();

                if (user > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Example #3
0
        public async Task <bool> BuyerRegister(BuyerRegister buyer)
        {
            Buyer buyer1 = new Buyer();

            if (buyer != null)
            {
                buyer1.Buyerid  = buyer.buyerId;
                buyer1.Username = buyer.userName;
                buyer1.Password = buyer.password;
                buyer1.Mobileno = buyer.mobileNo;
                buyer1.Email    = buyer.emailId;
                buyer1.Datetime = buyer.dateTime;
            }
            _context.Buyer.Add(buyer1);
            var user = await _context.SaveChangesAsync();

            if (user > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }