//[ProducesResponseType(200, Type = typeof(ProblemDetails))] //[ProducesResponseType(201, Type = typeof(ProblemDetails))] public ActionResult <CarResponse> Post(CarReequest item) { try { var result = item.ToModel(); app.Cars.Add(result); app.SaveChanged(); return(CreatedAtAction(nameof(GetById), new { id = result.Id }, result)); } catch (Exception ex) { throw new Exception(ex.Message); } }
//[ProducesResponseType(404, Type = typeof(ProblemDetails))] //[ProducesResponseType(402, Type = typeof(ProblemDetails))] //[ProducesResponseType(204, Type = typeof(ProblemDetails))] public ActionResult Put(Guid id, CarReequest item) { var res = app.Cars.Find(id); if (res == null) { return(NotFound()); } res.Make = item.Make; res.Model = item.Model; res.Color = item.Color; app.Cars.Update(res); app.SaveChanged(); return(NoContent()); }