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); }
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); }