$.ajax({
url: baseUrl + "/Admin/GetEnrollment",
type: "POST",
contentType: "application/json; charset=UTF-8",
dataType: "json",
data: JSON.stringify(model),
success: function (data) {
}});
[HttpPost]
public System.Web.Mvc.JsonResult GetEnrollment(SchoolEnrollment model, HttpRequestMessage request)
{
IList<SchoolEnrollment> EnrollmentList = new List<SchoolEnrollment>();
EnrollmentList = admin.GetEnrollment(model);
var data = new { EnrollmentList };
return new System.Web.Mvc.JsonResult()
{
Data = data,
JsonRequestBehavior = System.Web.Mvc.JsonRequestBehavior.AllowGet
};
}
url: baseUrl + "/Admin/GetEnrollment",
type: "POST",
contentType: "application/json; charset=UTF-8",
dataType: "json",
data: JSON.stringify(model),
success: function (data) {
}});
[HttpPost]
public System.Web.Mvc.JsonResult GetEnrollment(SchoolEnrollment model, HttpRequestMessage request)
{
IList<SchoolEnrollment> EnrollmentList = new List<SchoolEnrollment>();
EnrollmentList = admin.GetEnrollment(model);
var data = new { EnrollmentList };
return new System.Web.Mvc.JsonResult()
{
Data = data,
JsonRequestBehavior = System.Web.Mvc.JsonRequestBehavior.AllowGet
};
}
public IList<SchoolEnrollment> GetEnrollment(SchoolEnrollment model)
{
return dal.GetEnrollment(model);
}
public IList<SchoolEnrollment> GetEnrollment(SchoolEnrollment model)
{
IList<SchoolEnrollment> EnrollmentList = new List<SchoolEnrollment>();
SqlParameter[] sqlParameters = { SQLHelper.SqlParameter("@PageIndex",SqlDbType.Int, model == null ? 0 : model.PegInfo.PageIndex),
SQLHelper.SqlParameter("@PageSize",SqlDbType.Int, model == null ? 0 : model.PegInfo.PageSize),
};
try
{
using (SqlDataReader rdr = SQLHelper.ExecuteReader(SQLHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "[usp]", sqlParameters))
{
while (rdr.Read())
{
SchoolEnrollment vInfo = new SchoolEnrollment();
vInfo.ClassName = Functions.ToString(rdr["description"]);
vInfo.SchoolName = Functions.ToString(rdr["school_name"]);
vInfo.BoysCount = Functions.ToInt32(rdr["boys_count"]);
vInfo.GirlCount = Functions.ToInt32(rdr["girls_count"]);
vInfo.SchoolEnrollmentId = Functions.ToInt32(rdr["enrollment_id"]);
if (model != null)
{
if (model.PegInfo != null)
{
vInfo.PegInfo.PageIndex = model.PegInfo.PageIndex;
vInfo.PegInfo.PageSize = model.PegInfo.PageSize;
vInfo.PegInfo.TotalRecords = Functions.ToInt32(rdr["record_count"]);
}
}
EnrollmentList.Add(vInfo);
}
rdr.Close();
rdr.Dispose();
}
return EnrollmentList;
}
catch (Exception ex)
{
throw new BaseException(ex.Message, ex);
}
finally
{
}
}
No comments:
Post a Comment