Exemplo n.º 1
0
        public Disaster Create(Disaster disaster)
        {
            if (disaster == null)
            {
                throw new ArgumentNullException("disaster");
            }
            if (String.IsNullOrWhiteSpace(disaster.Name))
            {
                throw new ArgumentNullException("disasterName");
            }

            return(ourService.AddDisaster(disaster));
        }
Exemplo n.º 2
0
        public void Create(Disaster disaster)
        {
            if (disaster == null)
            {
                throw new ArgumentNullException("disaster");
            }
            if (String.IsNullOrWhiteSpace(disaster.Name))
            {
                throw new ArgumentNullException("disaster");
            }
            if (_dataService.Disasters.Any(d => d.Name == disaster.Name))
            {
                throw new DisasterAlreadyExistsException();
            }
            // Why should disaster name be unique?

            _dataService.AddDisaster(disaster);
        }