public void AddCar(CarRequest request) { if (request.userId == null || request.userId != "Admin") { throw new FaultException("You don't have permission to execute this method"); } try { logic.AddCar(request.inputs.registrationNumber, request.inputs.brand, request.inputs.model, request.inputs.year); } catch (ArgumentException) { throw new FaultException("Invalid request inputs"); } }
public CarInfo GetCarId(CarRequest request) { if (request.LicenseKey != "RentMyCar231") { throw new WebFaultException <string>( "Incorrect license key", HttpStatusCode.Forbidden); } else { try { var carData = new CarService(); var car = carData.GetById(request.CarId); return(new CarInfo(car)); } catch { throw new FaultException("That id is not valid, please provide a new one"); } } }
public void DeleteCar(CarRequest request) { dataContext.DeleteCar(request); }
public CarInfo GetCar(CarRequest request) { return(dataContext.GetCar(request)); }
public CarInfo GetCarInfo(CarRequest request) { return(api.GetCarInfo(request)); }