예제 #1
0
 static void logout()
 {
     Console.Clear();
     insub     = false;
     active    = "";
     collector = new mod.Collector();
     artist    = new mod.Artist();
     seller    = new mod.Seller();
 }
예제 #2
0
 public entity.Artist Parse(mod.Artist artist)
 {
     entity.Artist a = new entity.Artist();
     a.Name = artist.Name;
     a.Location = artist.Location;
     a.Biography = artist.Biography;
     a.Artiststatement = artist.ArtistStatement;
     if (a.Id == null) {
         a.Id = artist.Id;
     }
     return a;
 }
예제 #3
0
        public void Save(mod.Artist artist)
        {
            Artist tc = _context.Artists.Find(artist.Id);

            if (tc == null)
            {
                tc = _context.Artists.Add(_mapper.Parse(artist)).Entity;
                _context.SaveChanges();
            }
            tc.Name            = artist.Name;
            tc.Artiststatement = artist.ArtistStatement;
            tc.Biography       = artist.Biography;
            tc.Location        = artist.Location;
            _context.SaveChanges();
        }
예제 #4
0
 public mod.Artist AddArtist(mod.Artist newArtist)
 {
     try {
         if (newArtist.Id < 1)
         {
             //_context.Collectors.Load();
             newArtist = _mapper.Parse(_context.Artists.Where(x => x.Name.ToLower() == newArtist.Name.ToLower()).FirstOrDefault());
         }
     }
     catch { Console.WriteLine("what the?"); }
     if (Exists(newArtist.Id))
     {
         newArtist = _mapper.Parse(_context.Artists.Find(newArtist.Id));
     }
     else
     {
         Artist a = new Artist();
         _context.Artists.Add(a);
         _context.SaveChanges();
         newArtist = _mapper.Parse(a);
     }
     return(newArtist);
 }
예제 #5
0
        public void submitArt()
        {
            Console.Clear();
            if (active != "artist")
            {
                insub = true;
                Console.WriteLine("please enter your artist Id");
                artist = new mod.Artist();
                active = "artist";

                string userinput = Console.ReadLine();
                try {
                    artist.Id = int.Parse(userinput);
                }
                catch {
                    artist.Name = userinput;
                }
                ArtistRepo ap = new ArtistRepo(_context, new ArtistMapper());
                artist = ap.AddArtist(artist);

                if (artist.Name != null)
                {
                    Console.WriteLine($"welcome {artist.Name}");
                    viewProfile();
                }
                else
                {
                    registerNewArtist(ap);
                }
            }

            insub = true;
            while (insub)
            {
                subMenu();
            }
        }