public void Add(GuestbookAddCommand command) { this.Repository.Add(new Entry( command.Name, command.Message, Timestamp.UtcNow, command.IPAddress )); }
public IActionResult V1GuestbookPost(GuestbookAddRequest request) { var addCommand = new GuestbookAddCommand( new Name(request.name), new Message(request.message), new IPAddress(this.HttpContext.Connection.RemoteIpAddress) ); this.Service.Add(addCommand); var getCommand = new GuestbookGetCommand(request.count); var entries = this.Service.Get(getCommand); return(new JsonResult(entries.Select( entry => new SavedEntryModelConverter(entry).ToDictionary() ))); }