public ActionResult colissuesajax(int projid = 0, int colid = 0, int sort = 0, int filter = 0)
        {
            // for displaying the agile board
            var columns = db.columns.Include(c => c.project);
            var pr      = db.projects.Select(x => x).Where(x => x.id == projid).FirstOrDefault();
            //for the current sprint
            int currsp = pr.currentsprint.Value;
            //for the issues in the current sprint
            var xx = db.issues.Select(x => x).Where(x => x.projectid == projid && x.sprintid == currsp).ToList();
            //for the columns in the project
            var cols = db.columns.Select(x => x).Where(x => x.projectid == projid).ToList();
            // agile class contains columns and its issues
            AgileClass cc = new AgileClass();

            cc.Columns = cols;

            // for sorting 1: priority high to low , 2: priority low to high , 3: key name , 4: key name desc , 5 : name , 6 : name desc
            if (sort == 1)
            {
                xx = db.issues.Select(x => x).Where(x => x.projectid == projid && x.sprintid == currsp).OrderBy(x => x.priority).ToList();
            }
            if (sort == 2)
            {
                xx = db.issues.Select(x => x).Where(x => x.projectid == projid && x.sprintid == currsp).OrderByDescending(x => x.priority).ToList();
            }
            if (sort == 3)
            {
                xx = db.issues.Select(x => x).Where(x => x.projectid == projid && x.sprintid == currsp).OrderBy(x => x.keyname).ToList();
            }
            if (sort == 4)
            {
                xx = db.issues.Select(x => x).Where(x => x.projectid == projid && x.sprintid == currsp).OrderByDescending(x => x.keyname).ToList();
            }
            if (sort == 5)
            {
                xx = db.issues.Select(x => x).Where(x => x.projectid == projid && x.sprintid == currsp).OrderBy(x => x.descreption.Substring(0, 25)).ToList();
            }
            if (sort == 6)
            {
                xx = db.issues.Select(x => x).Where(x => x.projectid == projid && x.sprintid == currsp).OrderByDescending(x => x.descreption.Substring(0, 25)).ToList();
            }
            // filter 1 : User Story , 2 : bug

            if (filter == 1)
            {
                xx = xx.Where(x => x.type == "User Story").ToList();
            }
            if (filter == 2)
            {
                xx = xx.Where(x => x.type == "Bug").ToList();
            }
            ViewBag.pid             = projid;
            ViewBag.cid             = colid;
            ViewBag.currentsprintid = currsp;
            cc.issues = xx;
            return(PartialView("omardrag", cc));
        }
        public ActionResult Indexproject2(int id = 0, int sprintnum = 0, int sort = 0, int filter = 0)
        {
            // for displaying the agile board of the old sprints same as Indexproject

            if (User.IsInRole("developer"))
            {
                var adminproj = db.pojectdevs.Select(x => x).Where(x => x.projectid == id && x.devname == User.Identity.Name).FirstOrDefault();
                if (adminproj == null)
                {
                    return(RedirectToAction("Index", "project"));
                }
            }

            if (User.IsInRole("projectowner"))
            {
                var adminproj = db.projects.Select(x => x).Where(x => x.id == id && x.projectowner == User.Identity.Name).FirstOrDefault();
                if (adminproj == null)
                {
                    return(RedirectToAction("Index", "project"));
                }
            }

            if (User.IsInRole("teamleader"))
            {
                var adminproj = db.projects.Select(x => x).Where(x => x.id == id && x.projectleader == User.Identity.Name).FirstOrDefault();
                if (adminproj == null)
                {
                    return(RedirectToAction("Index", "project"));
                }
            }

            // ViewBag.projectid = id;
            //// var zz = db.projects.Select(x => x).Where(x => x.id == id).FirstOrDefault();

            // ViewBag.currentsp = sprintnum;

            // var columns = db.columns.Include(c => c.project);
            // var xx = db.columns.Select(x => x).Where(x => x.projectid == id).ToList();
            // return View(xx);
            var columns = db.columns.Include(c => c.project);
            var pr      = db.projects.Select(x => x).Where(x => x.id == id).FirstOrDefault();
            int currsp  = sprintnum;

            var        xx   = db.issues.Select(x => x).Where(x => x.projectid == id && x.sprintid == currsp).ToList();
            var        cols = db.columns.Select(x => x).Where(x => x.projectid == id).ToList();
            AgileClass cc   = new AgileClass();

            cc.Columns = cols;


            // 1: priority high to low , 2: priority low to high , 3: key name , 4: key name desc
            if (sort == 1)
            {
                xx = db.issues.Select(x => x).Where(x => x.projectid == id && x.sprintid == currsp).OrderBy(x => x.priority).ToList();
            }
            if (sort == 2)
            {
                xx = db.issues.Select(x => x).Where(x => x.projectid == id && x.sprintid == currsp).OrderByDescending(x => x.priority).ToList();
            }
            if (sort == 3)
            {
                xx = db.issues.Select(x => x).Where(x => x.projectid == id && x.sprintid == currsp).OrderBy(x => x.keyname).ToList();
            }
            if (sort == 4)
            {
                xx = db.issues.Select(x => x).Where(x => x.projectid == id && x.sprintid == currsp).OrderByDescending(x => x.keyname).ToList();
            }
            if (sort == 5)
            {
                xx = db.issues.Select(x => x).Where(x => x.projectid == id && x.sprintid == currsp).OrderBy(x => x.descreption.Substring(0, 25)).ToList();
            }
            if (sort == 6)
            {
                xx = db.issues.Select(x => x).Where(x => x.projectid == id && x.sprintid == currsp).OrderByDescending(x => x.descreption.Substring(0, 25)).ToList();
            }
            // filter 1 :

            if (filter == 1)
            {
                xx = xx.Where(x => x.type == "User Story").ToList();
            }
            if (filter == 2)
            {
                xx = xx.Where(x => x.type == "Bug").ToList();
            }


            cc.issues = xx;



            // 1: priority high to low , 2: priority low to high , 3: key name , 4: key name desc
            //if (sort == 1) { xx = db.issues.Select(x => x).Where(x => x.projectid == projid && x.status == colid && x.sprintid == currsp).OrderBy(x => x.priority).ToList(); }
            //if (sort == 2) { xx = db.issues.Select(x => x).Where(x => x.projectid == projid && x.status == colid && x.sprintid == currsp).OrderByDescending(x => x.priority).ToList(); }
            //if (sort == 3) { xx = db.issues.Select(x => x).Where(x => x.projectid == projid && x.status == colid && x.sprintid == currsp).OrderBy(x => x.keyname).ToList(); }
            //if (sort == 4) { xx = db.issues.Select(x => x).Where(x => x.projectid == projid && x.status == colid && x.sprintid == currsp).OrderByDescending(x => x.keyname).ToList(); }
            //if (sort == 5) { xx = db.issues.Select(x => x).Where(x => x.projectid == projid && x.status == colid && x.sprintid == currsp).OrderBy(x => x.descreption).ToList(); }
            //if (sort == 6) { xx = db.issues.Select(x => x).Where(x => x.projectid == projid && x.status == colid && x.sprintid == currsp).OrderByDescending(x => x.descreption).ToList(); }
            //// filter 1 :
            //if (filter == 1) { xx = xx.Where(x => x.type == "Epic").ToList(); }
            //if (filter == 2) { xx = xx.Where(x => x.type == "User Story").ToList(); }
            //if (filter == 3) { xx = xx.Where(x => x.type == "Bug").ToList(); }

            // ViewBag.cid = colid;
            //ViewBag.currentsprintid = currsp;
            var zz = db.sprints.Select(x => x).Where(x => x.sid == sprintnum).FirstOrDefault();

            ViewBag.currentsprintid = zz.number;
            ViewBag.spid            = zz.sid;
            ViewBag.pid             = id;

            return(View("omardrag2", cc));
        }