Beispiel #1
0
        public IActionResult FindexControl(int carId, int userId)
        {
            var carFindex  = _carFindexService.GetByCarId(carId);
            var userFindex = _userFindexService.GetByUserId(userId);

            if (userFindex.Data.FindexNot >= carFindex.Data.FindexNot)
            {
                return(Ok(new SuccessResult()));
            }

            return(BadRequest(new ErrorResult("Findex notunuz bu araç için uygun değil.Uygun araçlara bakabilirsiniz!")));
        }
Beispiel #2
0
        public IResult Add(Rental rental)
        {
            IResult result = BusinessRules.Run(RentalControl(rental.CarId), RentalCarIdControl(rental.CarId));

            if (result != null)
            {
                return(result);
            }

            var findex = _userFindexService.GetByUserId(rental.CustomerId);

            findex.Data.FindexNot = findex.Data.FindexNot + 500;
            _userFindexService.Update(findex.Data);
            _rentalDal.Add(rental);
            return(new SuccessResult(Messages.RentalAddedSuccess));
        }