Beispiel #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);
 }
Beispiel #2
0
        public ActionResult Create(CreatePropertyCommand command)
        {
            var handler = new CreatePropertyCommandHandler(_context);

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

            handler.Handle(command);

            return(RedirectToAction("MyProperties"));
        }
Beispiel #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"));
        }