public ActionResult CountBooks()
        {
            if (Session["CurUsr"] == null)
            {
                Response.Redirect("SignIn");
            }
            ViewData["People"] = DM.Rd.readers().ToList();
            ViewData["Counts"] = (from t in DM.Rd.readers() select t.BookGiving.Count).ToList();
            var values = (from t in DM.Rd.readers()
                          select new NamePlusCountBooks(t.FIO, t.Library_Card, t.Phone_Number, t.Email, t.Registration_Date, t.BookGiving.Count)).
                         OrderBy(p => p.Count).
                         Reverse().
                         ToList();

            ViewData["AllCounts"] = values;
            string path = Server.MapPath("~/Files/CountBooks.xlsx");

            ExcelExecuter.XLOutput_NamePlusCountBooks(path, values);
            return(View());
        }
        public ActionResult Debtors()
        {
            if (Session["CurUsr"] == null)
            {
                Response.Redirect("SignIn");
            }
            List <NamePlusCountBooks> NP = (from t in DM.Rd.readers()
                                            let countB = (from p in DM.BG.bookGivings()
                                                          where (p.Reader.Id == t.Id && p.BookReturning == null &&
                                                                 p.Expected_Return_Date < DateTime.Today)
                                                          select p).Count()
                                                         where countB > 0
                                                         select new NamePlusCountBooks(t.FIO, t.Library_Card, t.Phone_Number, t.Email,
                                                                                       t.Registration_Date, countB)).ToList();

            ViewData.Model      = NP;
            ViewData["Debtors"] = ViewData.Model;
            string path = Server.MapPath("~/Files/Debt.xlsx");

            ExcelExecuter.XLOutput_NamePlusCountBooks(path, NP);
            return(View());
        }