public async Task <ActionResult> UpdateProductMedia(UpdatedProperty updatedProductMedia)
        {
            ProductMedia productMedia = await unitOfWork.ProductMedia.Get(updatedProductMedia.ItemId);

            productMedia.MediaId = updatedProductMedia.PropertyId;

            // Update and save
            unitOfWork.ProductMedia.Update(productMedia);
            await unitOfWork.Save();

            return(Ok());
        }
        public async Task <ActionResult> UpdateVendor(UpdatedProperty updatedProperty)
        {
            Product product = await unitOfWork.Products.Get(updatedProperty.ItemId);

            product.VendorId = updatedProperty.PropertyId;

            // Update and save
            unitOfWork.Products.Update(product);
            await unitOfWork.Save();

            return(Ok());
        }
        public async Task <ActionResult> UpdateCategoryImage(UpdatedProperty updatedProperty)
        {
            Category category = await unitOfWork.Categories.Get(updatedProperty.ItemId);

            category.ImageId = updatedProperty.PropertyId;

            // Update and save
            unitOfWork.Categories.Update(category);
            await unitOfWork.Save();

            return(Ok());
        }
        public async Task <ActionResult> UpdateNicheImage(UpdatedProperty updatedProperty)
        {
            Niche niche = await unitOfWork.Niches.Get(updatedProperty.ItemId);

            niche.ImageId = updatedProperty.PropertyId;

            // Update and save
            unitOfWork.Niches.Update(niche);
            await unitOfWork.Save();

            return(Ok());
        }
        public async Task <ActionResult> AddProductMedia(UpdatedProperty productMedia)
        {
            ProductMedia newProductMedia = new ProductMedia
            {
                ProductId = productMedia.ItemId,
                MediaId   = productMedia.PropertyId
            };

            unitOfWork.ProductMedia.Add(newProductMedia);

            await unitOfWork.Save();

            return(Ok(newProductMedia.Id));
        }
Example #6
0
 public override int GetHashCode() => UpdatedProperty.GetHashCode();