public void AddTest()
        {
            var band = new Band();

            band.Name = "Test Name";

            bandsAccess.Add(band);

            var band2 = db.Bands.Where(b => b.Name == "Test Name").ToList().FirstOrDefault();

            Assert.AreEqual(band2.Name, band.Name);
        }
示例#2
0
        public Band Add(Band band)
        {
            band.NameError = "";

            if (band.Name == "")
            {
                band.NameError = Errors.BandErrors.EmptyName;
                return(band);
            }

            var otherBand = GetByName(band.Name);

            if (otherBand != null)
            {
                band.NameError = Errors.BandErrors.DuplicateName;
                return(band);
            }

            bandsAccess.Add(LogicToDB(band));

            return(band);
        }