/// <summary>
        /// disable an artist and set performances after now
        /// </summary>
        /// <param name="artist"></param>
        /// <returns></returns>
        public bool DeleteArtist(Artist artist)
        {
            IArtistDao dao      = DALFactory.CreateArtistDao(database);
            Artist     toDelete = dao.findById(artist.Id);

            if (toDelete == null)
            {
                return(false);
            }
            toDelete.Deleted = true;
            bool success = dao.Update(toDelete);

            if (success)
            {
                IPerformanceDao     performanceDao = DALFactory.CreatePerformanceDao(database);
                IList <Performance> performances   = performanceDao.FindPerformanceForArtistsAfterDate(toDelete, DateTime.Now);
                foreach (Performance p in performances)
                {
                    Console.WriteLine("found performances " + p.Id + "artist " + p.Artist.Name);
                    p.Canceld = true;
                    success   = performanceDao.Update(p);
                }
            }
            return(success);
        }
        public Artist SaveArtist(Artist artist)
        {
            IArtistDao dao = DALFactory.CreateArtistDao(database);

            if (artist.Id != null && artist.Id > 0)
            {
                dao.Update(artist);
                return(artist);
            }
            artist = dao.Insert(artist);
            return(artist);
        }
Esempio n. 3
0
        public void TestUpdate()
        {
            IArtistDao dao    = DALFactory.CreateArtistDao(DALFactory.CreateDatabase());
            Artist     artist = dao.findById(1);

            artist.Email = "*****@*****.**";
            dao.Update(artist);

            Artist result = dao.findById(1);

            Assert.AreEqual(result.Email, artist.Email);
        }
Esempio n. 4
0
 public void Update(ArtistDto artist)
 {
     _artistDao.Update(DtoConverter.Convert(artist));
 }