Esempio n. 1
0
        public Speaker CreateSpeaker(Speaker speaker)
        {
            if (string.IsNullOrEmpty(speaker.SpeakerName))
            {
                throw new InvalidDataException("Can not create a speaker without a name");
            }
            else if (speaker.Price <= 0)
            {
                throw new InvalidDataException("Can not create a speaker without a price");
            }
            else if (string.IsNullOrEmpty(speaker.SpeakerDescription))
            {
                throw new InvalidDataException("Can not create a speaker without a description");
            }
            else if (string.IsNullOrEmpty(speaker.Color))
            {
                throw new InvalidDataException("Can not create a speaker without a color");
            }

            if (string.IsNullOrEmpty(speaker.Brand))
            {
                throw new InvalidDataException("Can not create a speaker without a brand");
            }

            else if (string.IsNullOrEmpty(speaker.Url))
            {
                throw new InvalidDataException("Can not create a speaker without an url");
            }

            return(_speakerRepository.CreateSpeaker(speaker));
        }
Esempio n. 2
0
 public Speakers CreateSpeaker(Speakers speakers)
 {
     if (Isunique(speakers.CompanyName))
     {
         return(speakerRepository.CreateSpeaker(speakers));
     }
     return(null);
 }