예제 #1
0
        public IDataResult <List <CarImage> > GetImagesByCarId(int carId)
        {
            var errorResult = BusinessTool.GetFailedLogic(CheckCarImageIdIsExist(carId));

            if (errorResult != null)
            {
                return(new SuccessDataResult <List <CarImage> >(CheckCarImageIsNull(carId), Messages.SuccessfullyListedObjects));
            }
            return(new ErrorDataResult <List <CarImage> >(null, errorResult.Message));
        }
예제 #2
0
        public IDataResult <CarImage> Get(int id)
        {
            var errorResult = BusinessTool.GetFailedLogic(CheckCarImageIdIsExist(id));

            if (errorResult != null)
            {
                return(new ErrorDataResult <CarImage>(null, errorResult.Message));
            }
            return(new SuccessDataResult <CarImage>(_iCarImageDal.Get(c => c.Id == id), Messages.SuccessfullyGotObject));
        }
예제 #3
0
        public IResult Add(Rental rental)
        {
            IResult failedLogic = BusinessTool.GetFailedLogic(CheckRentedCarIsReturnedDateExist(rental.ReturnDate));

            if (failedLogic != null)
            {
                return(failedLogic);
            }
            _iRentalDal.Add(rental);
            return(new SuccessResult(Messages.SuccessfullyAdded));
        }
예제 #4
0
 public MainWindow()
 {
     InitializeComponent();
     try
     {
         BusinessTool BIApp = new BusinessTool();
         //this.AppsListBox.ItemsSource = BIApp._businessApplications;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #5
0
        public IResult Update(IFormFile file, CarImage carImage)
        {
            var errorResult = BusinessTool.GetFailedLogic(CheckImageLimitExceed(carImage.CarId));

            if (errorResult != null)
            {
                return(errorResult);
            }
            carImage.ImagePath   = FileHelper.UpdateImage(carImage.ImagePath, file);
            carImage.CreatedDate = DateTime.Now;
            _iCarImageDal.Update(carImage);
            return(new SuccessResult(Messages.SuccessfullyUpdated));
        }
예제 #6
0
        public IResult Add(Car car)
        {
            // the following rules will be in ValidationAspect give as an attribute

            var errorLogic = BusinessTool.GetFailedLogic(CheckAddedCarAlreadyExist(car.Id));

            if (errorLogic != null)
            {
                return(errorLogic);
            }
            _iCarDal.Add(car);
            return(new SuccessResult(Messages.SuccessfullyAdded));
        }