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()); }
public ActionResult CreatePost(BikeCreateViewModel model) { if (model.New.BranchId <= 0) { } else { bikeRepo.Create(model.New); } return(RedirectToAction("Index")); }
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)); } }