public ActionResult GetNumSubmisstionEachDepartment() { var listDep = DAManager.GetListDepartment(); List <ChartDataViewmodel> dataChart = new List <ChartDataViewmodel>(); foreach (var item in listDep) { var data = DAManager.GetListSubmisstionForAdmin(item.Dep_ID); ChartDataViewmodel a = new ChartDataViewmodel(); a.value = item.Dep_Name; a.num = data.Count(); dataChart.Add(a); } return(Json(dataChart, JsonRequestBehavior.AllowGet)); }
public ActionResult GetListSubmissionsByDepartment(int?DepID) { var data = dataAccess.GetListSubmisstionForAdmin(DepID); var currentDep = dataAccess.GetListDepartment().Where(x => x.Dep_ID == DepID).FirstOrDefault(); var res = data.Select(x => new SubmittionModel() { Sub_ID = x.Sub_ID, Sub_Title = x.Sub_Title, Department_ID = currentDep.Dep_ID, Department_Name = currentDep.Dep_Name, Description = x.Sub_Description, IsPublic = x.IsPublic, Created_Date = x.Created_Date.ToString() }).ToList(); return(Json(res, JsonRequestBehavior.AllowGet)); }
public ActionResult GetSubmissionForAdmin() { try { var userInfo = (UserLoginModel)Session[Helper.Commons.USER_SEESION_ADMIN]; var listData = dataAccess.GetListSubmisstionForAdmin(userInfo.Department_ID); var res = listData.Select(x => new SubmittionModel() { Sub_ID = x.Sub_ID, Sub_Title = x.Sub_Title, Department_ID = userInfo.Department_ID, Department_Name = userInfo.Department, Description = x.Sub_Description, Created_Date = x.Created_Date.ToString(), IsPublic = x.IsPublic }).ToList(); return(Json(res, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new List <SubmittionModel>(), JsonRequestBehavior.AllowGet)); } }