Esempio n. 1
0
        public async Task <IActionResult> ChangeStatus(Guid id)
        {
            try
            {
                ProductCategory productCategory = await _repository.GetByIdAsync(id);

                if (productCategory == null)
                {
                    return(NotFound());
                }

                productCategory.ChangeStatus();

                await _repository.UpdateAsync(productCategory);

                return(Ok());
            }

            catch (DataStoreException e)
            {
                _logger.LogError(e.Message, e, id);
                return(StatusCode(StatusCodes.Status500InternalServerError, e.Message));
            }
        }