示例#1
0
        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));
        }
示例#2
0
 //[ProducesResponseType(200, Type = typeof(ProblemDetails))]
 //[ProducesResponseType(404, Type = typeof(ProblemDetails))]
 public ActionResult <CarResponse> GetById(Guid id)
 {
     return(CarResponse.FromModel(app.Cars.Find(id)));
 }
示例#3
0
        public ActionResult <IEnumerable <CarResponse> > GetAll()
        {
            var cars = app.Cars.All.Select(x => CarResponse.FromModel(x)).ToList();

            return(cars);
        }
示例#4
0
 //[ProducesResponseType(200, Type = typeof(ProblemDetails))]
 public ActionResult <IEnumerable <CarResponse> > GetAll()
 {
     return(this.app.Cars.All.ToList().ConvertAll(it => CarResponse.FromModel(it)));
 }