public IViewComponentResult Invoke() { var contact = contactRepository.GetCompanyContact(); var model = ContactViewModel.GetViewModel(contact, countryRepository, localizer); return(View("~/Components/ViewComponents/CompanyAddress/Default.cshtml", model)); }
public static CafeViewModel GetViewModel(Cafe cafe, ICountryRepository countryRepository, IPageAttachmentUrlRetriever attachmentUrlRetriever) { return(new CafeViewModel { PhotoPath = cafe.Fields.Photo == null ? null : attachmentUrlRetriever.Retrieve(cafe.Fields.Photo).RelativePath, Note = cafe.Fields.AdditionalNotes, Contact = ContactViewModel.GetViewModel(cafe, countryRepository) }); }
private Dictionary <string, List <ContactViewModel> > GetPartnerCafesModel(IEnumerable <Cafe> cafes) { var cityCafes = new Dictionary <string, List <ContactViewModel> >(); // Group partner cafes by their location foreach (var cafe in cafes) { var city = cafe.City.ToLowerInvariant(); var contact = ContactViewModel.GetViewModel(cafe, countryRepository, localizer); if (cityCafes.ContainsKey(city)) { cityCafes[city].Add(contact); } else { cityCafes.Add(city, new List <ContactViewModel> { contact }); } } return(cityCafes); }
private List <ContactViewModel> GetCompanyCafesModel(IEnumerable <Cafe> cafes) { return(cafes.Select(cafe => ContactViewModel.GetViewModel(cafe, countryRepository, localizer)).ToList()); }
private ContactViewModel GetCompanyContactModel() { return(ContactViewModel.GetViewModel(contactRepository.GetCompanyContact(), countryRepository, localizer)); }