Exemplo n.º 1
0
 public bool DeleteById(int id)
 {
     try
     {
         bool isSuccess;
         using (var rentalRequestRepository = new RentalRequestRepository())
         {
             isSuccess = rentalRequestRepository.DeleteByID(id);
         }
         return(isSuccess);
     }
     catch (Exception ex)
     {
         LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true);
         throw new Exception("CarRental.BusinessLogic.Concretes::Delete:Error occured.", ex);
     }
 }
Exemplo n.º 2
0
 public bool Update(RentalRequests entity)
 {
     try
     {
         bool isSuccess;
         using (var rentalRequestRepository = new RentalRequestRepository())
         {
             isSuccess = rentalRequestRepository.Update(entity);
         }
         return(isSuccess);
     }
     catch (Exception ex)
     {
         LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true);
         throw new Exception("CarRental.BusinessLogic.Concretes: " + entity.GetType().ToString() + "::Update:Error occured.", ex);
     }
 }
Exemplo n.º 3
0
        public List <RentalRequests> GetAll()
        {
            var ResponseEntity = new List <RentalRequests>();

            try
            {
                using (var rentalRequestRepository = new RentalRequestRepository())
                {
                    foreach (var entity in rentalRequestRepository.GetAll())
                    {
                        ResponseEntity.Add(entity);
                    }
                }
                return(ResponseEntity);
            }
            catch (Exception ex)
            {
                LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true);
                throw new Exception("CarRental.BusinessLogic.Concretes:GenericBusinessLogic::GetAll::Error occured.", ex);
            }
        }
Exemplo n.º 4
0
 public RentalRequests GetByID(int id)
 {
     try
     {
         RentalRequests ResponseEntity;
         using (var rentalRequestRepository = new RentalRequestRepository())
         {
             ResponseEntity = rentalRequestRepository.GetByID(id);
             if (ResponseEntity == null)
             {
                 throw new NullReferenceException("Entity doesnt exists!");
             }
             return(ResponseEntity);
         }
     }
     catch (Exception ex)
     {
         LogHelper.Log(LogTarget.File, ExceptionHelper.ExceptionToString(ex), true);
         throw new Exception("CarRental.BusinessLogic.Concretes:GenericBusinessLogic::GetByID::Error occured.", ex);
     }
 }