71 lines
2.3 KiB
C#
71 lines
2.3 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Web.Http;
|
|
using BLL;
|
|
|
|
namespace WebAPI.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 学习园地
|
|
/// </summary>
|
|
public class StudyZoneController : ApiController
|
|
{
|
|
#region 获取学习园地资源明细列表
|
|
|
|
/// <summary>
|
|
/// 获取学习园地资源大类列表
|
|
/// </summary>
|
|
/// <param name="supId"></param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getStudyZoneTypeList(string supId)
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
if (string.IsNullOrWhiteSpace(supId))
|
|
{//默认顶级
|
|
supId = "0";
|
|
}
|
|
var getQualityLists = APIStudyZoneService.getStudyZoneTypeList(supId);
|
|
responeData.data = getQualityLists.OrderBy(u => u.StudyZoneCode).ToList();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
return responeData;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取学习园地资源明细列表
|
|
/// </summary>
|
|
/// <param name="typeId"></param>
|
|
/// <param name="itemName"></param>
|
|
/// <param name="pageIndex"></param>
|
|
/// <returns></returns>
|
|
public Model.ResponeData getStudyZoneItemList(string typeId, string itemName, int pageIndex)
|
|
{
|
|
var responeData = new Model.ResponeData();
|
|
try
|
|
{
|
|
var getQualityLists = APIStudyZoneService.getStudyZoneItemList(typeId, itemName);
|
|
int pageCount = getQualityLists.Count;
|
|
if (pageCount > 0 && pageIndex > 0)
|
|
{
|
|
var getdata = from x in getQualityLists.OrderBy(u => u.StudyZoneItemCode).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize)
|
|
select x;
|
|
responeData.data = new { pageCount, getdata };
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
responeData.code = 0;
|
|
responeData.message = ex.Message;
|
|
}
|
|
return responeData;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|