public void SetUp() { _context = Substitute.For <IOrangeBricksContext>(); _context.Properties.Returns(Substitute.For <IDbSet <Domain.Models.Property> >()); _handler = new CreatePropertyCommandHandler(_context); _offerHandler = new MakeOfferCommandHandler(_context); }
public ActionResult Create(CreatePropertyCommand command) { var handler = new CreatePropertyCommandHandler(_context); command.SellerUserId = User.Identity.GetUserId(); handler.Handle(command); return(RedirectToAction("MyProperties")); }
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")); }