//contact vendor page public virtual async Task <IActionResult> ContactVendor(int vendorId) { if (!_vendorSettings.AllowCustomersToContactVendors) { return(RedirectToRoute("Homepage")); } var vendor = await _vendorService.GetVendorByIdAsync(vendorId); if (vendor == null || !vendor.Active || vendor.Deleted) { return(RedirectToRoute("Homepage")); } var model = new ContactVendorModel(); model = await _commonModelFactory.PrepareContactVendorModelAsync(model, vendor, false); return(View(model)); }
public async Task CanPrepareContactVendorModel() { var model = new ContactVendorModel(); model = await _commonModelFactory.PrepareContactVendorModelAsync(model, _vendor, true); model.Email.Should().BeNullOrEmpty(); model.FullName.Should().BeNullOrEmpty(); model.SubjectEnabled = _commonSettings.SubjectFieldOnContactUsForm; model.DisplayCaptcha.Should().BeFalse(); model.VendorId.Should().Be(_vendor.Id); model.VendorName.Should().Be(_vendor.Name); model = await _commonModelFactory.PrepareContactVendorModelAsync(model, _vendor, false); model.Email.Should().Be(NopTestsDefaults.AdminEmail); model.FullName.Should().Be("John Smith"); model.SubjectEnabled = _commonSettings.SubjectFieldOnContactUsForm; model.DisplayCaptcha.Should().BeFalse(); model.VendorId.Should().Be(_vendor.Id); model.VendorName.Should().Be(_vendor.Name); }