コード例 #1
0
ファイル: CityLogic.cs プロジェクト: rubenpazch/Security
        public bool DeleteCityById(int empId)
        {
            try
            {
                using (var repository = new CityRepository())
                {
                    return(repository.DeleteById(empId));
                }
            }
            catch (Exception ex)
            {
                //Log exception error
                _loggingHandler.LogEntry(ExceptionHandler.GetExceptionMessageFormatted(ex), true);

                throw new Exception("BusinessLogic:CitysBusiness::DeleteCityById::Error occured.", ex);
            }
        }
コード例 #2
0
        public async Task <bool> DeleteCityAsync(object Id)
        {
            bool result = false;

            if (Id != null)
            {
                City d = await cityRepository.GetAsync(Id);

                if (d != null)
                {
                    try
                    {
                        cityRepository.DeleteById(Id);
                        result = true;
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
            return(result);
        }