Beispiel #1
0
        public ActionResult DeleteCategory(int categoryid)
        {
            try
            {
                var category = _repo.GetCategoryByID(categoryid).ToList();
                var listing  = _repo.GetListingByCategoryId(categoryid).ToList();

                _repo.RemoveCategory(categoryid);
                _repo.Save();

                SetImmageFile setImageFile = new SetImmageFile();
                setImageFile.DeleteImageFile(category[0].image, this.HttpContext);
                foreach (var items in listing)
                {
                    setImageFile.DeleteImageFile(items.image, this.HttpContext);
                }

                return(Json(new { success = true }));
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
Beispiel #2
0
        public ActionResult DeleteListing(int listingid, int categoryid, string categoryname)
        {
            try
            {
                var listing = _repo.GetListingById(listingid).ToList();

                _repo.RemoveListing(listingid);
                _repo.Save();

                SetImmageFile setImageFile = new SetImmageFile();
                setImageFile.DeleteImageFile(listing[0].image, this.HttpContext);

                return(Json(new { success = true }));
            }
            catch
            {
                return(RedirectToAction("GetCategoryListings", new { categoryid = categoryid, categoryname = categoryname }));
            }
        }
Beispiel #3
0
        public ActionResult DeleteListing(int listingid, int categoryid, string categoryname)
        {
            try
            {
                var listing = _repo.GetListingById(listingid).ToList();

                _repo.RemoveListing(listingid);
                _repo.Save();

                SetImmageFile setImageFile = new SetImmageFile();
                setImageFile.DeleteImageFile(listing[0].image, this.HttpContext);

                return Json(new { success = true });
            }
            catch
            {
                return RedirectToAction("GetCategoryListings", new { categoryid = categoryid, categoryname = categoryname });
            }
        }
Beispiel #4
0
        public ActionResult DeleteCategory(int categoryid)
        {
            try
            {
                var category = _repo.GetCategoryByID(categoryid).ToList();
                var listing = _repo.GetListingByCategoryId(categoryid).ToList();

                _repo.RemoveCategory(categoryid);
                _repo.Save();

                SetImmageFile setImageFile = new SetImmageFile();
                setImageFile.DeleteImageFile(category[0].image, this.HttpContext);
                foreach (var items in listing)
                {
                    setImageFile.DeleteImageFile(items.image, this.HttpContext);
                }

                return Json(new { success = true });
            }
            catch
            {
                return RedirectToAction("Index");
            }
        }