Ejemplo n.º 1
0
 public void SetUp()
 {
     _context = Substitute.For <IOrangeBricksContext>();
     _context.Properties.Returns(Substitute.For <IDbSet <Domain.Models.Property> >());
     _handler      = new CreatePropertyCommandHandler(_context);
     _offerHandler = new MakeOfferCommandHandler(_context);
 }
Ejemplo n.º 2
0
        public ActionResult Create(CreatePropertyCommand command)
        {
            var handler = new CreatePropertyCommandHandler(_context);

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

            handler.Handle(command);

            return(RedirectToAction("MyProperties"));
        }
Ejemplo n.º 3
0
        public ActionResult Create(CreatePropertyCommand command)
        {
            var handler = new CreatePropertyCommandHandler(_context);

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

            handler.Handle(command);

            ModelState.AddModelError("", "A post with this title already exists.");

            return(RedirectToAction("MyProperties"));
        }