Пример #1
0
 public int AddProduct(
     string id,
     string name,
     decimal price,
     int count)
 {
     _productRepositorie.AddProduct(id, name, price, count);
     return(0);
 }
Пример #2
0
        public async Task <IActionResult> AddProduct([FromBody] Inventoryes model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var postId = await _ProductRepositories.AddProduct(model);

                    if (postId > 0)
                    {
                        return(Ok(postId));
                    }
                    else
                    {
                        return(NotFound());
                    }
                }
                catch (Exception)
                {
                    return(BadRequest());
                }
            }
            return(BadRequest());
        }