public ActionResult login(tabeluser avm)
        {
            tabeluser ad = db.tabelusers.Where(x => x.u_email == avm.u_email && x.u_password == avm.u_password).SingleOrDefault();

            if (ad != null)
            {
                Session["u_id"] = ad.u_id.ToString();
                return(RedirectToAction("Index"));
            }
            else
            {
                ViewBag.error = "Invalid username or password";
            }

            return(View());
        }
        public ActionResult SignUp(tabeluser uvm, HttpPostedFileBase imgfile)
        {
            string path = uploadimgfile(imgfile);

            if (path.Equals("-1"))
            {
                ViewBag.error = "Image could not be uploaded....";
            }
            else
            {
                tabeluser u = new tabeluser();
                u.u_name     = uvm.u_name;
                u.u_email    = uvm.u_email;
                u.u_password = uvm.u_password;
                u.u_image    = path;
                u.u_contact  = uvm.u_contact;
                db.tabelusers.Add(u);
                db.SaveChanges();
                return(RedirectToAction("ViewCategory"));
            }

            return(View());
        }
        public ActionResult ViewAd(int?id)
        {
            Adviewmodel  ad = new Adviewmodel();
            tabelproduct p  = db.tabelproducts.Where(x => x.pro_id == id).SingleOrDefault();

            ad.pro_id    = p.pro_id;
            ad.pro_name  = p.pro_name;
            ad.pro_image = p.pro_image;
            ad.pro_price = p.pro_price;
            ad.pro_des   = p.pro_des;
            tabelcategory cat = db.tabelcategories.Where(x => x.cat_id == p.pro_fk_cat).SingleOrDefault();

            ad.cat_name = cat.cat_name;
            tabeluser u = db.tabelusers.Where(x => x.u_id == p.pro_fk_user).SingleOrDefault();

            ad.u_name      = u.u_name;
            ad.u_image     = u.u_image;
            ad.u_contact   = u.u_contact;
            ad.pro_fk_user = u.u_id;



            return(View(ad));
        }