Ejemplo n.º 1
0
        public IActionResult Post([FromBody] Market market)
        {
            try
            {
                if (market != null)
                {
                    _logger.LogInformation("API Request hit: INSERT Market : " + market.Name);
                    var result = _marketRepository.Add(market);

                    if (result == 0)
                    {
                        return(Ok("{\"status\": \"Success\"}"));
                    }
                    else
                    {
                        _logger.LogInformation("API Request (INSERT Market : " + market.Name + " ) not committed");
                        return(NotFound("Failed: INSERT could not commit"));
                    }
                }
                else
                {
                    _logger.LogInformation("API Request hit (INSERT Market) with null entry");
                    return(BadRequest("Failed: null entry"));
                }
            }

            catch (Exception e)
            {
                _logger.LogError("API Request (INSERT Market) FAILED: ", e);
                return(BadRequest("Failed"));
            }
        }
Ejemplo n.º 2
0
 public void Add(Market market)
 {
     _marketRepository.Add(market);
 }
Ejemplo n.º 3
0
 public async Task <int> AddMarket(Markets market)
 {
     return(await _marketRepository.Add(market));
 }