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);
            }
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int bid, [Bind("BId,Username,Password,Email,Mobileno")] Buyer buyer)
        {
            if (bid != buyer.BId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(buyer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BuyerExists(buyer.BId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(BuyerIndex)));
            }
            return(View(buyer));
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("Id,Name,Address,Mail,Phoneno,Password")] Buyer buyer)
        {
            if (ModelState.IsValid)
            {
                _context.Add(buyer);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(buyer));
        }
Esempio n. 4
0
        public async Task <bool> EditBuyerProfile(BuyerData buyer)
        {
            Buyer buyer1 = _context.Buyer.Find(buyer.buyerId);

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

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

            if (buyer != null)
            {
                buyer1.Bid      = 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);
            }
        }
Esempio n. 6
0
        public async Task <bool> BuyerRegister(Buyer buyer)
        {
            _context.Buyer.Add(buyer);
            var user = await _context.SaveChangesAsync();

            if (user > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 7
0
        public async Task <bool> EditBuyerProfile(Buyer buyer)
        {
            _context.Update(buyer);
            var user = await _context.SaveChangesAsync();

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