+1 hopefully someone will add their project as open source. i have heard of a couple of project with relate and mvc during the spring of 2013
Hi Eric
I'm not aware of these projects, do you have any more information you can share about them? I know of other Partners and developers that are interested in this.
Cheers
Steve
There are no public project but since we all need them I will ask and se if it is possible for them to share some information at least.
Hey there,
I think Eric is referring to a project I am about to finish in a couple of weeks :-). It is an intranet project with EPiServer 7, Find, MVC and Community.
We built it from scratch and did not use any templates. I am afraid I cannot share the code though, the ones that hired me wouldnt be to happy about that..
My experience with the combination of product we used is that it works fine. The problems we had would have existed if we used each product separately too. We used MVC and EPiServer to build the website and the Community API to handle notifications, contacts and so on.
If you guys have more specific questions I'll try to answer them. I am not a frequent visitor to the forums though so you might need to be a bit patient..
/Trana
Hey Eric and Trana
Thank-you for coming back to me so swiftly. I appreciate the sensitivity in terms of not sharing the code, however I think the fact that you've got the products to work togther offers the necessary reassurance required here.
I'll point the developers who were enquiring about this in the direction of this thread! Further questions may follow at some point...
Cheers
Steve
Hi Mikael,
Presumably in your project you used the Relate API to include Relate functionality within MVC pages rather than keeping the Relate functionality separate as web forms? If so are you able to provide a simple example of how you achieved this please?
Thanks,
Mark
Hi Mark,
you are correct, we did not use any web forms pages in our project. Here is a short example for a controller that returns a "My contacts page":
MyContactsPageController : PageControllerBase<MyContactsPage>
{
private readonly IContactService _contactService;
public MyContactsPageController(IContactService contactService)
{
_contactService = contactService;
}
public ActionResult Index(MyContactsPage currentPage)
{
var viewModel = new MyContactsPageViewModel
{
CurrentPage = currentPage,
Contacts = _contactService.GetUserContacts(Context.CurrentUser),
};
return View(viewModel);
}
}
_contactService.GetUserContacts calls this method that uses the community API to get contacts:
public List<IUser> GetContacts(IUser user, int page, int pageSize)
{
var contacts = _cacheService.Get<List<IUser>>(_cacheService.CacheKeys.GetUserContactsCacheKey(user.UserName, page, pageSize));
if (contacts != null)
return contacts;
int totalItems;
ContactContainer userContainer = MyPageHandler.Instance.GetMyPage(user).Contact;
var sortOrder = new ContactRelationSortOrder(ContactRelationSortField.ContactAlias, SortingDirection.Ascending);
var userContacts = ContactHandler.Instance.GetContacts(userContainer, EntityStatus.Approved, page, pageSize, out totalItems, sortOrder);
contacts = _contactSortRepository.GetSortedContactsWithUserSortOrder(user, userContacts.Select(c => c.ContactUser).ToList());
if (contacts != null)
_cacheService.AddContactList(contacts, user.UserName, page, pageSize);
return contacts;
}
Hope that helps,
Miakel
Any more updates on this from EPiServer or has anyone else got stories they can share around implementing Relate with MVC templates.
Just wondering if there was any plans to create an MVC version of the Relate+ example templates, like the EPiServer 7 MVC templates package Joel created for the Alloy CMS example site?
Jim