/// <summary>
/// Get StaticSection
/// </summary>
/// <returns></returns>
[System.Web.Http.HttpGet]
[ValidateApiAccessToken]
[ApiExceptionFilter(LoggerType = typeof(VolunteerApiLogger))]
[ResponseType(typeof(List<ApiStaticSection>))]
[System.Web.Http.Route("~/api/Volunteering/StaticSection/")]
public HttpResponseMessage GetStaticSection()
{
try
{
var orgConnection = OrganizationGuid.HasValue ? DataSources.ConnectionDictionary[OrganizationGuid.Value] : String.Empty;
var apiStaticSection = new List<ApiStaticSection>();
var entityModel = _customContentService.GetStaticSection(orgConnection);
if (entityModel == null)
return Request.CreateResponse(HttpStatusCode.OK, apiStaticSection);
apiStaticSection.AddRange(entityModel.Select(item => new ApiStaticSection
{
StaticSectionId = item.StaticSectionId,
SectionName = item.SectionName,
SectionType = item.SectionType
}));
return Request.CreateResponse(HttpStatusCode.OK, apiStaticSection);
}
catch (PersistenceValidationException ex)
{
return Request.CreateResponse(HttpStatusCode.BadRequest, ex.BrokenRules);
}
}