Implementing the backend service

To create the backend service, you must perform the following:

  1. From the context menu of the folder Services, click Add » Class...

  2. Name the class file JobsBackendService.cs and click Add.

  3. Open the file JobsBackendService.cs.

  4. Add the following using statements:

    using System.Collections.Generic;
    using System.Linq;
    using Jobs.Model;
    using Jobs.Services.Data;
    using Telerik.Sitefinity.Modules;
    using Telerik.Sitefinity.Modules.GenericContent;

  5. Make the JobsBackendService class inherit the ContentServiceBase<JobApplication, JobApplicationViewModel, JobsManager>class:

    public class JobsBackendService : ContentServiceBase<JobApplication, JobApplicationViewModel, JobsManager>
    {
    }

  6. Implement the abstract members of the ContentServiceBase in the following way:

    public override IQueryable<JobApplication> GetChildContentItems(Guid parentId, string providerName)
    {
        throw new NotSupportedException();
    }
     
    public override JobApplication GetContentItem(Guid id, string providerName)
    {
        return this.GetManager(providerName).GetJobApplication(id);
    }
     
    public override IQueryable<JobApplication> GetContentItems(string providerName)
    {
        return this.GetManager(providerName).GetJobApplications();
    }
     
    public override JobsManager GetManager(string providerName)
    {
        return JobsManager.GetManager(providerName);
    }
     
    public override JobApplication GetParentContentItem(Guid id, string providerName)
    {
        throw new NotSupportedException();
    }
     
    public override IEnumerable<JobApplicationViewModel> GetViewModelList(IEnumerable<JobApplication> contentList, ContentDataProviderBase dataProvider)
    {
        var viewModelList = new List<JobApplicationViewModel>();
        foreach (var product in contentList)
            viewModelList.Add(new JobApplicationViewModel(product, dataProvider));
        return viewModelList;
    }

Next steps

+1-888-365-2779
sales@sitefinity.com

Related topics:

Feedback

How useful is this article?

Tell us more

Submit
Your message was successfully sent.

We appreciate your feedback.

Your message could not be sent.

OK