public ActionResult <CarResponse> GetById(Guid id) { var car = app.Cars.Find(id); if (car == null) { return(NotFound(new ProblemDetails { Title = "Invalid car id" })); } return(CarResponse.FromModel(car)); }
//[ProducesResponseType(200, Type = typeof(ProblemDetails))] //[ProducesResponseType(404, Type = typeof(ProblemDetails))] public ActionResult <CarResponse> GetById(Guid id) { return(CarResponse.FromModel(app.Cars.Find(id))); }
public ActionResult <IEnumerable <CarResponse> > GetAll() { var cars = app.Cars.All.Select(x => CarResponse.FromModel(x)).ToList(); return(cars); }
//[ProducesResponseType(200, Type = typeof(ProblemDetails))] public ActionResult <IEnumerable <CarResponse> > GetAll() { return(this.app.Cars.All.ToList().ConvertAll(it => CarResponse.FromModel(it))); }