示例#1
0
        public object BindModel(ActionContext actionContext, ModelBindingContext bindingContext)
        {
            var cart = actionContext.HttpContext.Session[SessionKey];

            if (cart == null)
            {
                cart = Uitilties.ObjectToByteArray(new Cart());
                actionContext.HttpContext.Session[SessionKey] = cart;
            }
            return(cart);
        }
示例#2
0
        public FileContentResult GetImage(int productId)
        {
            Product product = _repository.GetAll().FirstOrDefault(p => p.ProductId == productId);

            if (product != null)
            {
                FileContentResult image = new FileContentResult(Uitilties.ObjectToByteArray(product.ImageData), product.ImageMimeType);
                //return File(product.ImageData, product.ImageMimeType);
                return(image);
            }
            return(null);
        }