コード例 #1
0
        public void HandlerShouldAddViewing()
        {
            // Arrange
            var command = new RequestViewingCommand
            {
                PropertyId = 1
            };

            // Act
            _handler.Handle(command);

            // Assert
            var property = _context.Properties.First();

            Assert.IsNotEmpty(property.Viewings);
        }
コード例 #2
0
        public ActionResult RequestViewing(RequestViewingCommand command)
        {
            // Set the BuyerUserId before calling the command handler
            command.BuyerUserId = User.Identity.GetUserId();

            var handler = new RequestViewingCommandHandler(_context);

            handler.Handle(command);

            return(RedirectToAction("Index"));
        }
コード例 #3
0
        public ActionResult RequestViewing(RequestViewingCommand command)
        {
            var handler = new RequestViewingCommandHandler(_context);

            if (string.IsNullOrEmpty(command.ViewingTime))
            {
                command.ViewingTime = "09:00";
            }

            command.RequestedUserId = User.Identity.GetUserId();

            handler.Handle(command);

            return(RedirectToAction("Index"));
        }