예제 #1
0
        public void sellArt()
        {
            Console.Clear();
            if (active != "seller")
            {
                Console.WriteLine("please enter your seller Id");
                seller = new mod.Seller();
                active = "seller";

                string userinput = Console.ReadLine();
                try {
                    seller.Id = int.Parse(userinput);
                }
                catch {
                    seller.name = userinput;
                }
                SellerRepo cp = new SellerRepo(_context, new SellerMapper());
                seller = cp.AddSeller(seller);

                if (seller.name != "")
                {
                    Console.WriteLine($"welcome {seller.name}");
                    viewProfile();
                }
                else
                {
                    registerNewSeller(cp);
                }
            }
            insub = true;
            while (insub)
            {
                subMenu();
            }
        }
예제 #2
0
 void registerNewSeller(SellerRepo sp)
 {
     Console.Clear();
     Console.WriteLine("Please register as a Seller to continue.");
     seller.name = getinput("What is your name ?");
     sp.Save(seller);
     Console.WriteLine($"Thank you for registering! your customer id is: {seller.Id}");
 }
예제 #3
0
        public void attachToSeller()
        {
            Console.Clear();
            SellerRepo cp = new SellerRepo(_context, new SellerMapper());
            ArtRepo    ap = new ArtRepo(_context, new ArtMapper());

            ap.ShowArtByArtist(artist.Id);
            int artid  = getint("Please enter the id of the art you'de like to attach.");
            int sellid = getint("Please Enter the id of the seller you'de like to attach to.");

            try {
                cp.AddInventory(artid, sellid);
            }
            catch (Exception) {
                Console.WriteLine("There was an issue with attachment, please try again.");
            }
        }
예제 #4
0
 public void SetUp()
 {
     _repo     = new SellerRepo(new EmartContext());
     _itemrepo = new Itemrepo(new EmartContext());
 }