public IActionResult Delete(NRental rental) { var result = _iRentalService.Delete(rental); if (result.Success == true) { return(Ok(result)); } return(BadRequest(result)); }
public IResult Add(NRental rental) { if (rental.ReturnDate == null) { return(new ErrorResult(Messages.RentalDateInvalid)); } else { _iRentalDal.Add(rental); return(new SuccessResult(Messages.RentalAdded)); } }
public IResult isCarAvailable(NRental rental) { var result = _iRentalDal.GetAll(r => r.CarId == rental.CarId); if (result.Any(r => r.RentDate != null && r.ReturnDate == null)) { return(new ErrorResult("Messages.CarIsNotAvailable")); } else { return(new SuccessResult()); } }
private static void RentalAddTest() { Console.WriteLine("------------------Araç Kiralama------------------------"); RentalManager rentalManager = new RentalManager(new EfRentalDAL()); NRental rental2 = new NRental(); rental2.CarId = 2; rental2.CustomerId = 6; rental2.ReturnDate = DateTime.Now; var rental = rentalManager.Add(rental2); Console.WriteLine(rental.Message); }
public IResult Update(NRental rental) { _iRentalDal.Update(rental); return(new SuccessResult(Messages.RentalUpdated)); }
public IResult Delete(NRental rental) { _iRentalDal.Delete(rental); return(new SuccessResult(Messages.RentalDeleted)); }