Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Are there any plans to create MVC Relate+ templates?

Vote:
 

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

#72397
Jun 14, 2013 15:48
Vote:
 

+1

#72496
Jun 18, 2013 23:30
Vote:
 

+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

#73706
Aug 06, 2013 14:18
Vote:
 

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

#75936
Oct 11, 2013 14:13
Vote:
 

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.

#75941
Oct 11, 2013 16:20
Vote:
 

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

 

#75943
Oct 11, 2013 16:52
Vote:
 

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

#75970
Oct 14, 2013 12:56
Vote:
 

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

#76004
Oct 15, 2013 12:13
Vote:
 

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
#76005
Edited, Oct 15, 2013 12:42
Vote:
 

Any more updates on this from EPiServer or has anyone else got stories they can share around implementing Relate with MVC templates.

#82436
Mar 12, 2014 10:55
This thread is locked and should be used for reference only. Please use the Legacy add-ons forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.