public void check_stock()
 {
     try
     {
         int           flag    = 0;
         List <string> proname = new List <string>();
         string        name    = Session["user"].ToString();
         int           id      = db.User_Table.Where(x => x.UserName == name).Select(x => x.UserId).FirstOrDefault();
         List <int>    nlist   = db.Notify_table.Where(x => x.Userid == id && x.flag == 0).Select(x => x.Productid).ToList();
         foreach (int item in nlist)
         {
             Notify_table  nobj = db.Notify_table.Where(x => x.Userid == id && x.Productid == item).FirstOrDefault();
             Product_Table pobj = db.Product_Table.Where(x => x.ProductId == item).FirstOrDefault();
             if (pobj.ProductStock > 0)
             {
                 flag = 1;
                 proname.Add(pobj.ProductName);
                 //nobj.flag = 1;
                 db.SaveChanges();
             }
         }
         if (flag == 1)
         {
             ViewBag.stock_list = proname;
         }
         else
         {
             ViewBag.stock_list = null;
         }
     }
     catch
     {
         Response.Redirect("~/User/login");
     }
 }
        public void del_check_stock()
        {
            string     name  = Session["user"].ToString();
            int        id    = db.User_Table.Where(x => x.UserName == name).Select(x => x.UserId).FirstOrDefault();
            List <int> nlist = db.Notify_table.Where(x => x.Userid == id && x.flag == 0).Select(x => x.Productid).ToList();

            foreach (int item in nlist)
            {
                Notify_table  nobj = db.Notify_table.Where(x => x.Userid == id && x.Productid == item).FirstOrDefault();
                Product_Table pobj = db.Product_Table.Where(x => x.ProductId == item).FirstOrDefault();
                if (pobj.ProductStock > 0)
                {
                    nobj.flag = 1;
                    db.SaveChanges();
                }
            }
        }
        public JsonResult remind(int id)
        {
            string       name = Session["user"].ToString();
            User_Table   obj  = db.User_Table.Where(x => x.UserName == name).FirstOrDefault();
            Notify_table nobj = db.Notify_table.Where(x => x.Userid == obj.UserId && x.Productid == id && x.flag == 0).FirstOrDefault();

            if (nobj != null)
            {
            }
            else
            {
                Notify_table nobj1 = new Notify_table();
                nobj1.Userid    = obj.UserId;
                nobj1.Productid = id;
                nobj1.flag      = 0;
                db.Notify_table.Add(nobj1);
                db.SaveChanges();
            }
            return(Json(new {  }, JsonRequestBehavior.AllowGet));
        }