Пример #1
0
        //Actors
        public void AddActor(string actorName, string dob)
        {
            DateTime dDate, actorDob;

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


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


            Actor actor = new Actor()
            {
                Name = actorName,
                DOB  = actorDob
            };

            _actorRepository.AddActorData(actor);
        }