Ejemplo n.º 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());
        }
Ejemplo n.º 2
0
        public ActionResult CreatePost(BikeCreateViewModel model)
        {
            if (model.New.BranchId <= 0)
            {
            }
            else
            {
                bikeRepo.Create(model.New);
            }

            return(RedirectToAction("Index"));
        }
Ejemplo n.º 3
0
 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));
     }
 }