public ActionResult DelData(AccessPassModel model)
        {
            try
            {
                int mm  = model.month;
                int yy  = model.year;
                int cid = 0;
                if (model.CompID != null && model.CompID != 0)
                {
                    cid = Convert.ToInt32(model.CompID);
                }
                AccessPassService      objService = new AccessPassService();
                AccessPassModel        objModel   = new AccessPassModel();
                List <AccessPassModel> objList    = new List <AccessPassModel>();

                objList         = objService.getAPDataByMMYY(cid, mm, yy);
                objModel.ListAP = new List <AccessPassModel>();
                objModel.ListAP.AddRange(objList);
                foreach (var i in objModel.ListAP)
                {
                    int id = i.APID;
                    objModel = objService.getByID(id);
                    Dbcontext.AccessPassMasters.Remove(Dbcontext.AccessPassMasters.Find(id));
                    Dbcontext.SaveChanges();
                }
                int c = objList.Count();
                TempData["Msg"] = c + "Record Deleted.";
            }
            catch (Exception ex)
            {
                TempData["Msg"] = "Record Not Deleted. " + ex;
                return(View("Error"));
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Index(AccessPassModel model)
        {
            AccessPassService      objService = new AccessPassService();
            AccessPassModel        objModel   = new AccessPassModel();
            List <AccessPassModel> objList    = new List <AccessPassModel>();
            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            int mm = Convert.ToInt32(model.month);
            int yy = Convert.ToInt32(model.year);

            objList         = objService.getAPDataByMMYY(cid, mm, yy);
            objModel.ListAP = new List <AccessPassModel>();
            objModel.ListAP.AddRange(objList);

            UserService         objServiceComp = new UserService();
            List <CompanyModel> ListComp       = new List <CompanyModel>();

            ListComp          = objServiceComp.getActiveComp();
            objModel.ListComp = new List <CompanyModel>();
            objModel.ListComp.AddRange(ListComp);

            return(View(objModel));
        }