public Sighting AddNote( IEnumerable <string> tags, IDictionary <string, string> descriptions, string comments, DateTime createdOn, User createdByUser) { Check.RequireNotNull(tags, "tags"); Check.RequireNotNull(descriptions, "descriptions"); Check.RequireNotNull(createdByUser, "createdByUser"); var maxId = _sightingNotes.Count > 0 ? _sightingNotes.Select(x => x.SequentialId).Max() : 0; SightingNote sightingNote = SetSightingNote(maxId + 1, tags, descriptions, comments, createdOn, createdByUser); ApplyEvent(new DomainModelCreatedEvent <SightingNote>(sightingNote, createdByUser, this)); return(this); }
private SightingNote SetSightingNote( int id, IEnumerable <string> tags, IDictionary <string, string> descriptions, string comments, DateTime createdOn, User createdByUser) { var sightingNote = new SightingNote( id, createdByUser, tags, descriptions, comments, createdOn); _sightingNotes.Add(sightingNote); return(sightingNote); }
public Sighting UpdateNote( int id, IEnumerable <string> tags, IDictionary <string, string> descriptions, string comments, DateTime updatedOn, User updatedByUser) { Check.RequireNotNull(tags, "tags"); Check.RequireNotNull(descriptions, "descriptions"); Check.RequireNotNull(updatedByUser, "updatedByUser"); SightingNote sightingNote = _sightingNotes.Single(x => x.SequentialId == id); sightingNote.UpdateDetails( updatedByUser, tags, descriptions, comments); ApplyEvent(new DomainModelUpdatedEvent <SightingNote>(sightingNote, updatedByUser, this)); return(this); }