Example #1
0
        public async Task <(bool Success, string Error)> DeletePriceAsync(int id)
        {
            bool   success = false;
            string error   = string.Empty;

            try
            {
                if (id > 0)
                {
                    var price = await _priceRepository.FetchBasePriceByIdAsync(id);

                    if (price != null)
                    {
                        await _priceRepository.DeletePriceAsync(price);

                        success = true;
                    }
                    else
                    {
                        error = "Price information not found";
                    }
                }
                else
                {
                    error = "Invalid Id";
                }
            }
            catch (Exception ex)
            {
                error = "Unexpected error occurred while processing your request";
                _logger.LogError("AdminService.DeletePriceAsync - Exception:{@Ex}", args: new object[] { ex });
            }

            return(Success : success, Error : error);
        }