public IActionResult Add(GuestbookPostDto post)
        {
            _postsRepository.Add(post);

            var posts = _postsRepository.GetAll().ToList();

            return(View("Index", new GuestbookViewModel()
            {
                Posts = posts
            }));
        }
Пример #2
0
        public IActionResult Add(GuestbookRecordDto newRecord)
        {
            newRecord.AddedOn = DateTime.UtcNow;
            newRecord.Id      = Guid.NewGuid();
            _guestbookRepository.Add(newRecord);

            var records = _guestbookRepository.GetAll().ToList();

            return(View("Index", new GuestbookViewModel()
            {
                Records = records
            }));
        }