public IEnumerable <TaskTypeModel> TaskTypesForAutomobile(string vin) { if (string.IsNullOrWhiteSpace(vin)) { throw new ArgumentException("VIN is invalid"); } var taskTypes = new List <TaskTypeModel>(); var dieselAuto = _dieselRepo.GetAutomobile(vin); var electricAuto = _electricRepo.GetAutomobile(vin); var gasAuto = _gasRepo.GetAutomobile(vin); if (dieselAuto != null) { taskTypes.Add(new TaskTypeModel(TaskType.OilChange)); taskTypes.Add(new TaskTypeModel(TaskType.TireRotation)); taskTypes.Add(new TaskTypeModel(TaskType.GlowPlugReplacement)); } else if (electricAuto != null) { taskTypes.Add(new TaskTypeModel(TaskType.OilChange)); taskTypes.Add(new TaskTypeModel(TaskType.TireRotation)); taskTypes.Add(new TaskTypeModel(TaskType.BatteryPackReplacement)); } else if (gasAuto != null) { taskTypes.Add(new TaskTypeModel(TaskType.OilChange)); taskTypes.Add(new TaskTypeModel(TaskType.TireRotation)); taskTypes.Add(new TaskTypeModel(TaskType.SparkPlugReplacement)); } return(taskTypes); }
public IHttpActionResult GetAutomobile(string id) { var auto = _repository.GetAutomobile(id); if (auto == null) { return(NotFound()); } return(Ok(auto)); }