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); } }
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); } }
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); } }
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); } }