Beispiel #1
0
        public async Task <IActionResult> ActivateInventoryAsync([FromBody] int id)
        {
            try
            {
                _logger.LogDebug("Activating Inventory Part");
                bool success = await _inventoryService.ActivateAsync(id);

                if (success)
                {
                    _logger.LogDebug("Inventory part updated.");
                    return(Ok("Inventory part updated successfully"));
                }
                else
                {
                    _logger.LogDebug("Update failed. Inventory Part not Found");
                    return(Conflict("Inventory part not found"));
                }
            }
            catch (Exception ex)
            {
                //log
                _logger.LogError("An Exception occured: {ex}", ex.Message);
                _logger.LogError("Stack Trace: {ex}", ex.StackTrace);
                return(BadRequest());
            }
        }