예제 #1
0
        public async Task <bool> AddItems(ItemDetails items)
        {
            Items items1 = new Items();

            if (items != null)
            {
                items1.Itemid      = items.Itemid;
                items1.Sellerid    = items.Sellerid;
                items1.Itemname    = items.Itemname;
                items1.Price       = items.Price;
                items1.Remarks     = items.Remarks;
                items1.Stockno     = items.Stockno;
                items1.Description = items.Description;
                items1.Imagename   = items.Imagename;
            }
            _context.Add(items1);
            var item = await _context.SaveChangesAsync();

            if (item > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// To Add new seller to Seller table in database
        /// </summary>
        /// <param name="seller"></param>
        /// <returns></returns>
        public async Task <bool> SellerRegister(SellerRegister seller)
        {
            Seller seller1 = new Seller();

            if (seller != null)
            {
                seller1.Sellerid    = seller.Sellerid;
                seller1.Username    = seller.Username;
                seller1.Password    = seller.Password;
                seller1.Gst         = seller.Gst;
                seller1.Companyname = seller.Companyname;
                seller1.Aboutcmpy   = seller.Aboutcmpy;
                seller1.Address     = seller.Address;
                seller1.Website     = seller.Website;
                seller1.Email       = seller.Email;
                seller1.Mobileno    = seller.Mobileno;
            }
            ;
            _context.Add(seller1);
            await _context.SaveChangesAsync();

            if ((seller1.Username != seller.Username) && (seller1.Email != seller.Email))
            {
                _context.Add(seller1);
                await _context.SaveChangesAsync();

                return(true);
            }
            else
            {
                return(false);
            }
        }
        public async Task <bool> EditSellerProfile(SellerDetails seller)
        {
            Seller seller1 = _context.Seller.Find(seller.Sellerid);

            if (seller1 != null)
            {
                seller1.Username    = seller.Username;
                seller1.Password    = seller.Password;
                seller1.Gst         = seller.Gst;
                seller1.Companyname = seller.Companyname;
                seller1.Aboutcmpy   = seller.Aboutcmpy;
                seller1.Address     = seller.Address;
                seller1.Website     = seller.Website;
                seller1.Email       = seller.Email;
                seller1.Mobileno    = seller.Mobileno;
                _context.Seller.Update(seller1);
                var user = await _context.SaveChangesAsync();

                if (user > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// To Add new seller to Seller table in database
        /// </summary>
        /// <param name="seller"></param>
        /// <returns></returns>
        public async Task <bool> SellerRegister(SellerRegister seller)
        {
            //_context.Seller.Add(seller);
            //var user = await _context.SaveChangesAsync();
            //if(user>0)
            //{
            //    return true;
            //}
            //else
            //{
            //    return false;
            //}
            Seller seller1 = new Seller();

            if (seller != null)
            {
                seller1.Sid         = seller.Sid;
                seller1.Username    = seller.Username;
                seller1.Password    = seller.Password;
                seller1.Gst         = seller.Gst;
                seller1.Companyname = seller.Companyname;
                seller1.Aboutcmpy   = seller.Aboutcmpy;
                seller1.Address     = seller.Address;
                seller1.Website     = seller.Website;
                seller1.Email       = seller.Email;
                seller1.Mobileno    = seller.Mobileno;
            }
            ;
            _context.Add(seller1);
            var sellerId = await _context.SaveChangesAsync();

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