public ActionResult OnProperty(int id) { var builder = new ViewingsOnPropertyViewModelBuilder(_context); var viewModel = builder.Build(id); return(View(viewModel)); }
public ActionResult OnPropertyByMe(int id) { var builder = new ViewingsOnPropertyViewModelBuilder(_context); var viewModel = builder.Build(id, User.Identity.GetUserId()); return(View("OnProperty", viewModel)); }
public void BuildShouldReturnViewingsForProperty() { // Arrange var builder = new ViewingsOnPropertyViewModelBuilder(_context); // Act var viewModel = builder.Build(1); // Assert Assert.That(viewModel.Viewings.Count, Is.EqualTo(2)); }
public ActionResult MyViewings(int propertyId) { try { var builder = new ViewingsOnPropertyViewModelBuilder(_context); var viewModel = builder.Build(propertyId); return(View(viewModel)); } catch (Exception e) { return(View("Error", new HandleErrorInfo(e, GetType().Name, MethodBase.GetCurrentMethod().Name))); } }