public void ListAllCars() { ViewResult result = Db.View("getall", null, "car"); foreach (var item in result.Rows) { carDTO car = JsonConvert.DeserializeObject <carDTO>(item.ToString()); Console.Write("\n"); Console.WriteLine("Araç Şasi No : " + car.Id); Console.WriteLine("Araç Motor No : " + car.Key); Console.WriteLine("Marka : " + car.Value[0]); Console.WriteLine("Model : " + car.Value[1]); Console.WriteLine("Yıl : " + car.Value[2]); Console.WriteLine("Fiyat : " + car.Value[3]); } }
public HttpResponseMessage AddCar(carDTO car) { try { if (!ModelState.IsValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ErrorsManager.GetErrors(ModelState))); } string addedCar = logic.AddCar(car); return(Request.CreateResponse(HttpStatusCode.Created, addedCar)); } catch (Exception ex) { return(Request.CreateErrorResponse( HttpStatusCode.InternalServerError, ErrorsManager.GetInnerMessage(ex))); } }