Exemplo n.º 1
0
        public JsonResult Delete(string id)
        {
            var model = new SubjectsDAO().delete(id);
            var sub   = new SubjectsDAO().getsubject().Select(a => new
            {
                ID          = a.ID,
                NAME        = a.NAME,
                DESCRIPTION = a.DESCRIPTION
            });
            int totalRow = sub.Count();

            return(Json(new
            {
                total = totalRow,
                status = true
            }));
        }
Exemplo n.º 2
0
        public JsonResult GetSubjects(string name, int page, int pageSize)
        {
            var ListSubjects = new SubjectsDAO().getsubject().Select(a => new
            {
                ID          = a.ID,
                NAME        = a.NAME,
                DESCRIPTION = a.DESCRIPTION
            });

            if (!string.IsNullOrEmpty(name))
            {
                ListSubjects = ListSubjects.Where(x => x.NAME.Contains(name));
            }
            int TotalRow    = ListSubjects.Count();
            var lstSubjects = ListSubjects.Skip((page - 1) * pageSize).Take(pageSize);

            return(Json(new
            {
                total = TotalRow,
                data = lstSubjects,
                status = true
            }, JsonRequestBehavior.AllowGet));
        }