Inheritance: RevisableEntity
        public void Handle(CreateGeographicExpertise command)
        {
            if (command == null)
            {
                throw new ArgumentNullException("command");
            }

            var person = _entities.Get <Person>().SingleOrDefault(p => p.User.Name == command.Principal.Identity.Name);

            if (person == null)
            {
                string message = string.Format("Person {0} not found.", command.Principal.Identity.Name);
                throw new Exception(message);
            }

            var expertise = new GeographicExpertise
            {
                PersonId    = person.RevisionId,
                Description = command.Description,

                CreatedByPrincipal = command.Principal.Identity.Name,
                CreatedOnUtc       = DateTime.UtcNow
            };

            if (command.EntityId.HasValue)
            {
                expertise.EntityId = command.EntityId.Value;
            }

            _entities.Create(expertise);

            if (!command.NoCommit)
            {
                _unitOfWork.SaveChanges();
            }

            command.CreatedGeographicExpertise = expertise;
        }
Ejemplo n.º 2
0
 protected bool Equals(GeographicExpertise other)
 {
     return Locations.SequenceEqual(other.Locations) &&
             string.Equals(Description, other.Description);
 }
Ejemplo n.º 3
0
 protected bool Equals(GeographicExpertise other)
 {
     return(Locations.SequenceEqual(other.Locations) &&
            string.Equals(Description, other.Description));
 }