Esempio n. 1
0
        //Producers
        public void AddProducer(string producerName, string dob)
        {
            DateTime dDate, producerDob;

            if (string.IsNullOrEmpty(producerName))
            {
                throw new ArgumentException("Actor name can't be empty!");
            }

            if (DateTime.TryParse(dob, out dDate))
            {
                String.Format("{0:d/MM/yyyy}", dDate);
                producerDob = DateTime.ParseExact(dob, "d/M/yyyy", CultureInfo.InvariantCulture);
            }
            else
            {
                throw new Exception("Invalid Date of Birth Format!");
            }


            Producer producer = new Producer()
            {
                Name = producerName,
                DOB  = producerDob
            };

            _producerRepository.AddProducerData(producer);
        }