Пример #1
0
        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()
                                      )));
        }
Пример #2
0
        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()
                                      )));
        }
Пример #3
0
 public IEnumerable <SavedEntryModel> Get(GuestbookGetCommand command)
 {
     return(this.Repository.Get(command.Count).Select(
                entry => new SavedEntryModel(entry)
                ));
 }