Example #1
0
        public int SetProduct(Product product)
        {
            _logger.Info($"BLL.{nameof(ProductBll)}.{nameof(SetProduct)}: Retention of the product");

            if (product.Category != null)
            {
                _logger.Info($"BLL.{nameof(ProductBll)}.{nameof(SetProduct)}: Category discovered");

                product.Category.Id = _categoryBll.SetCategory(product.Category);
            }
            else
            {
                _logger.Info($"BLL.{nameof(ProductBll)}.{nameof(SetProduct)}: Category not discovered");
            }

            if (product.Id != null)
            {
                int id = _productDao.ChangeProduct(product);

                _logger.Info($"BLL.{nameof(ProductBll)}.{nameof(SetProduct)}: Product id = {id} changed");

                return(id);
            }
            else
            {
                int id = _productDao.AddProduct(product);

                _logger.Info($"BLL.{nameof(ProductBll)}.{nameof(SetProduct)}: Product id = {id} added");

                return(id);
            }
        }
Example #2
0
        public Guid Post(ProductCreateInputModel model)
        {
            var product = new ProductSummary
            {
                Name  = model.Name,
                Price = model.Price
            };

            return(_productDao.AddProduct(product));
        }
 public ActionResult Create(ProductModel model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             objProductDao.AddProduct(new Product()
             {
                 Name = model.Name, Price = model.Price, qty = model.qty
             });
             return(RedirectToAction("Index"));
         }
     }
     catch
     {
         return(View());
     }
     return(View());
 }
Example #4
0
 public void AddProduct(Product product, string categoryName)
 {
     productDao.AddProduct(product, categoryName);
 }
Example #5
0
 public bool AddProduct(Product p)
 {
     return(productDao.AddProduct(p));
 }
Example #6
0
        ///// <summary>
        ///// Removes specific vendor
        ///// </summary>
        ///// <param name="id">Identifier</param>
        ///// <returns>No of vendors Deleted</returns>
        //public int Delete(int id = 0)
        //{
        //    return ProductDao.De(id);
        //}

        /// <summary>
        /// Create new vendor
        /// </summary>
        /// <param name="product">Create vendor object</param>
        public void Add(Product product)
        {
            ProductDao.AddProduct(product);
        }