示例#1
0
        public async Task <IActionResult> AddProduct([FromBody] Inventoryes model)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    var postId = await _ProductRepositories1.AddProduct(model);

                    if (postId > 0)
                    {
                        _logger.LogInformation(postId.ToString());
                        return(Ok(postId));
                    }
                    else
                    {
                        _logger.LogInformation("NotFound");
                        return(NotFound());
                    }
                }
                catch (Exception ex)
                {
                    _logger.LogInformation(ex.Message);
                    return(BadRequest());
                }
            }
            return(BadRequest());
        }