public IActionResult V1GuestbookGet(GuestbookGetRequest request) { var getCommand = new GuestbookGetCommand(request.count); var entries = this.Service.Get(getCommand); return(new JsonResult(entries.Select( entry => new SavedEntryModelConverter(entry).ToDictionary() ))); }
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() ))); }
public IEnumerable <SavedEntryModel> Get(GuestbookGetCommand command) { return(this.Repository.Get(command.Count).Select( entry => new SavedEntryModel(entry) )); }