// GET: BazaarShopKeeper/Details/5
        public ActionResult Details(int id)
        {
            TempData["idperson"] = id;
            ViewData["person"]   = id;
            TempData["foredit"]  = id;
            int      person = id;
            Shoppack s      = new Shoppack();

            s.shopKeeper = db1.ShopKeepers.Find(id);


            if (s.shopKeeper == null)   //if shopkeeper has no shop
            {
                return(RedirectToAction("Index", "BuyPackage", new { @id = person }));
            }
            TempData["sid"] = s.shopKeeper.LoginId;
            s.shop          = db1.Shops.Find(s.shopKeeper.ShopID);

            s.picture      = db1.Pictures.Where(x => x.ShopID == s.shopKeeper.ShopID).FirstOrDefault();
            s.categorylist = db1.Categories.Where(x => x.ShopID == id).ToList();

            if (s.picture != null)
            {
                return(View(s));
            }
            return(View());
        }
        public ActionResult profile(int id)
        {
            Shoppack a = new Shoppack();

            a.shopKeeper = db1.ShopKeepers.Where(x => x.ShopID == id).FirstOrDefault();
            int login = a.shopKeeper.LoginId;

            a.person = db1.Logins.Find(a.shopKeeper.LoginId);
            return(View(a));
        }
        public ActionResult Index()
        {
            Shoppack a = new Shoppack();

            a.categorylist = db.Categories.ToList();
            a.itemlist     = db.Items.ToList();
            a.picturelist  = db.Pictures.Where(x => x.ItemID != null).ToList();

            return(View(a));
        }
Exemple #4
0
        // GET: Customer
        public ActionResult Index(int id)
        {
            ViewData["login"] = id;
            Shoppack a = new Shoppack();

            a.customer     = db.Customers.Find(id);
            a.categorylist = db.Categories.ToList();
            a.itemlist     = db.Items.ToList();
            a.picturelist  = db.Pictures.Where(x => x.ItemID != null).ToList();
            return(View(a));
        }
        public ActionResult CategoryDelete(int id)
        {
            Shoppack a = new Shoppack();

            a.category = db1.Categories.Find(id);
            a.itemlist = db1.Items.Where(x => x.CategoryId == id).ToList();
            a.item     = db1.Items.Where(x => x.CategoryId == id).FirstOrDefault();
            if (a.category == null)
            {
                return(HttpNotFound());
            }
            return(View(a));
        }
        public ActionResult ShopPicture(int id)
        {
            Shoppack a = new Shoppack();

            a.picture                = db1.Pictures.Where(x => x.ShopID == id).FirstOrDefault();
            a.shopKeeper             = db1.ShopKeepers.Where(x => x.ShopID == id).FirstOrDefault();
            TempData["shopkeeperid"] = a.shopKeeper.LoginId;
            TempData["shopid"]       = a.picture.ShopID;
            if (a.picture.picture1 != null)
            {
                return(View(a));
            }
            return(View());
        }
        public ActionResult CategoryDel(int id)
        {
            try
            {
                Shoppack obj = new Shoppack();

                obj.itemlist = db1.Items.Where(x => x.CategoryId == id).ToList();
                if (obj.itemlist != null)
                {
                    int i = 0;
                    do
                    {
                        obj.picturelist = db1.Pictures.Where(x => x.ItemID == obj.itemlist[i].Id).ToList();
                        for (int k = 0; k < obj.picturelist.Count; k++)
                        {
                            db1.Pictures.Remove(obj.picturelist[k]);
                        }
                        db1.SaveChanges();
                        i = i + 1;
                    } while (i < obj.itemlist.Count);

                    for (int j = 0; j < obj.itemlist.Count; j++)
                    {
                        db1.Items.Remove(obj.itemlist[j]);
                    }
                    db1.SaveChanges();
                }
                if (id != null)
                {
                    obj.category = db1.Categories.Find(id);
                    db1.Categories.Remove(obj.category);
                    db1.SaveChanges();
                    return(RedirectToAction("CategoryIndex", new { idshop = (Convert.ToInt32(TempData["backlist"])) }));
                }
                ViewBag.Message = string.Format("Unable to delete category!");
                return(View());
            }
            catch
            {
                ViewBag.Message = string.Format("Failed to delete category!");
                return(View());
            }
        }
Exemple #8
0
        public ActionResult savelist(int id)
        {
            int      login = id;
            Shoppack a     = new Shoppack();

            a.savelist = db.Saveds.Where(s => s.CustomerId == id).ToList();
            if (a.savelist != null)
            {
                a.itemlist = db.Items.ToList();


                return(View(a));
            }
            else
            {
                ViewBag.Message = string.Format("Your wish list is empty!");
                return(RedirectToAction("Index", new { id = login }));
            }
        }