Exemplo n.º 1
0
 public bool DeleteById(int id)
 {
     try
     {
         bool isSuccess;
         using (var rentedVehicleRepo = new RentedVehicleRepository())
         {
             isSuccess = rentedVehicleRepo.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(RentedVehicles entity)
 {
     try
     {
         bool isSuccess;
         using (var rentedVehicleRepo = new RentedVehicleRepository())
         {
             isSuccess = rentedVehicleRepo.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 <RentedVehicles> GetAll()
        {
            var ResponseEntity = new List <RentedVehicles>();

            try
            {
                using (var rentedVehicleRepo = new RentedVehicleRepository())
                {
                    foreach (var entity in rentedVehicleRepo.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 RentedVehicles GetByID(int id)
 {
     try
     {
         RentedVehicles ResponseEntity;
         using (var rentedVehicleRepo = new RentedVehicleRepository())
         {
             ResponseEntity = rentedVehicleRepo.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);
     }
 }