public ActionResult AddProduct(ProductDTO product)
        {
            if (ModelState.IsValid)
            {
                _logger.Info("Adding product, Name - " + product.Name);
                var guid = _repo.AddProduct(product);

                if (guid != null)
                {
                    _logger.Info("Product added, ID - " + guid);
                    return new JsonNetResult() { Data = new { success = true, ID = guid } };
                }
            }

            _logger.Info("Product could not be added");
            return new JsonNetResult() { Data = new { success = false } };
        }
        public ActionResult UpdateProduct(ProductDTO product)
        {
            if (ModelState.IsValid)
            {
                var success = _repo.UpdateProduct(product);

                if (success)
                    return new JsonNetResult() { Data = new { success = true } };
            }

            return new JsonNetResult() { Data = new { success = false } };
        }
        public void AddProduct()
        {
            //arrange
            var repo = Setup.SetupMockRepository();

            var api = new ProductsController(repo.Object, new NLogger(this.GetType().Name));
            var count = repo.Object.Products.Count();

            var productDTO = new ProductDTO()
            {
                Name = "test",
                Price = 50,
                Quantity = 30,
                    Colors = new List<ColorDTO>() {
                            new ColorDTO() {
                                Name = "#00dd00"
                            }
                     }
            };

            JObject result = JObject.FromObject(((JsonNetResult)api.AddProduct(productDTO)).Data);
            var success = (bool)result.Property("success");

            //assert
            Assert.That(count+1, Is.EqualTo(repo.Object.Products.Count()));
            Assert.That(success, Is.True);
        }