Exemple #1
0
        public ActionResult Delete(int id)
        {
            try
            {
                _logger.Log(LogLevel.Information, string.Format("DELETE:delete Customer details API Invoked for Id:{0}", id));
                var customer = _customerRepo.GetByMockDataId(id);

                if (customer == null)
                {
                    return(NotFound($"Customer with Id = {id} not found"));
                }

                return(Ok(_customerRepo.DeleteCustomerData(id)));
            }
            catch (Exception)
            {
                _logger.Log(LogLevel.Error, string.Format("DELETE:delete Customer details API Failed for Id:{0}", id));
                return(StatusCode(StatusCodes.Status500InternalServerError,
                                  "Error deleting data"));
            }
        }