コード例 #1
0
        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]);
            }
        }
コード例 #2
0
ファイル: CarsController.cs プロジェクト: gio-pumi/RentCar
        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)));
            }
        }