Beispiel #1
0
        public JsonResult DeleteFile(int id)
        {
            ImageObject.DeleteImage(id);
            var imageFileDescription = ImageObject.GetImageLinkById(0);

            return(Json(new
            {
                fileLink = imageFileDescription.FileLink,
                isDefaultImage = imageFileDescription.IsDefaultImage
            }, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        public JsonResult UploadFile(HttpPostedFileBase file, int id)
        {
            ImageObject.SaveImage(file, id);
            var imageFileDescription = ImageObject.GetImageLinkById(id);

            return(Json(new
            {
                fileLink = imageFileDescription.FileLink,
                isDefaultImage = imageFileDescription.IsDefaultImage
            }, JsonRequestBehavior.AllowGet));
        }
Beispiel #3
0
        public JsonResult GetAllProducts()
        {
            var productsListBo = m_facade.GetAllProducts();

            var productsList = (from product in productsListBo
                                select new
            {
                id = product.Id,
                catalogId = product.CatalogId,
                name = product.Name,
                description = product.Description,
                fileLink = ImageObject.GetImageLinkById(product.Id).FileLink,
                isDefaultImage = ImageObject.GetImageLinkById(product.Id).IsDefaultImage,
                qty = ""
            }).ToList();

            return(Json(productsList, JsonRequestBehavior.AllowGet));
        }
Beispiel #4
0
        public JsonResult GetProduct(int id)
        {
            var productBo = m_facade.GetProductById(id);

            if (productBo == null)
            {
                return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
            }

            var imageFileDescription = ImageObject.GetImageLinkById(productBo.Id);
            var product = new
            {
                id             = productBo.Id,
                catalogId      = productBo.CatalogId,
                name           = productBo.Name,
                description    = productBo.Description,
                fileLink       = imageFileDescription.FileLink,
                isDefaultImage = imageFileDescription.IsDefaultImage,
                qty            = ""
            };

            return(Json(product, JsonRequestBehavior.AllowGet));
        }