Ejemplo n.º 1
0
        public void Handle(IUserSession userSessionIssuingCommand, object command)
        {
            var c = (CreateNewDisaster) command;
            var u = (UserSession) userSessionIssuingCommand;

            var itemToCreate = new Disaster(_timeProvider.Now(), c.LocationDescription, c.Latitude, c.Longitude);
            itemToCreate.AddSeverityVote(u.User, c.FirstSeverity);

            Disaster newDisaster = _writeableRepository.Create(itemToCreate);
            NotifyObservers(new NewDisasterCreated(u.User.Id,newDisaster.Id, newDisaster.CreatedDate, c.LocationDescription,
                                                   c.Latitude, c.Longitude, c.FirstSeverity));
        }
Ejemplo n.º 2
0
        public void Handle(IUserSession userSessionIssuingCommand, object command)
        {

            var c = (CreateNewDisaster) command;
            var u = (UserSession)userSessionIssuingCommand;

            var itemToCreate = new Disaster(c.CreatedDate, c.LocationDescription, c.Latitude, c.Longitude);

            var newDisasterImage = itemToCreate.AddImage(c.FirstImageUrl);
            var newSeverityVote = itemToCreate.AddSeverityVote(u.User, c.FirsSeverity);
            var newDisaster = _writeableRepository.Create(itemToCreate);

            NotifyObservers(new NewDisasterCreated(newDisaster.Id, newDisaster.CreatedDate, c.LocationDescription, c.Latitude, c.Longitude, c.FirstImageUrl,c.FirsSeverity));

        }