コード例 #1
0
        public void TestAddBike()
        {
            Bike bike = new Bike
            {
                Id          = 1,
                Description = "Montain",
                Price       = 20,
                Disponible  = true,
                Image       = "123456",
                RentPointId = 1
            };

            bikeRepository.Create(bike);
            Assert.AreEqual(1, bikeRepository.Count());
        }
コード例 #2
0
ファイル: BikeController.cs プロジェクト: bob7007/FirstWebApp
        public ActionResult CreatePost(BikeCreateViewModel model)
        {
            if (model.New.BranchId <= 0)
            {
            }
            else
            {
                bikeRepo.Create(model.New);
            }

            return(RedirectToAction("Index"));
        }
コード例 #3
0
ファイル: BikesController.cs プロジェクト: dSiles98/CyclePath
 public IActionResult PostBike(int rentPointId, [FromBody] Bike bike)
 {
     try
     {
         bike.RentPointId = rentPointId;
         bike.Disponible  = true;
         bikesRepository.Create(bike);
         return(Ok());
     }
     catch (System.Exception exe)
     {
         return(BadRequest(exe.Message));
     }
 }