Exemplo n.º 1
0
        /// <summary>
        /// Load the media items pointed to by 'pathfilenames' into the 'Model'
        /// </summary>
        /// <param name="pathfilenames">a vector of strings; each string containing path/filename for an image file to be loaded</param>
        /// <returns>the unique identifiers of the images that have been loaded</returns>
        public IList <string> load(IList <string> pathfilenames)
        {
            // maybe use a delegate for the ImageStore class which we pass in the return from the imagefactory to.
            _imageStore.AddImage(pathfilenames);

            //Returns the path names of the inmages so that the form can use them as keys for image requests etc
            return(pathfilenames);
        }
        public IActionResult UploadImage(int id)
        {
            TbProductImage productImage = unitOfWork.ProductImages.Get(id);

            if (productImage == null)
            {
                return(NotFound());
            }
            if (imageStorage.AddImage(HttpContext.Request, id))
            {
                productImage.Extension = imageStorage.GetFileExtention(HttpContext.Request);
                unitOfWork.Complete();
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }