public ActionResult Create(ModelTypeRents model) { if (ModelState.IsValid) { _repositorytyperents.AddTypeRent(model); } return(RedirectToAction("Index")); }
public void AddTypeRent(ModelTypeRents model) { using (var db = new DAL.BikeEntities()) { db.TypeRents.Add(MapToDB(model)); db.SaveChanges(); } }
private DAL.TypeRents MapToDB(ModelTypeRents model) { return(new DAL.TypeRents() { id = model.id, name = model.name, price = model.price }); }
public void EditTypeRent(ModelTypeRents model) { using (var db = new DAL.BikeEntities()) { var aEdit = db.TypeRents.Find(model.id); aEdit.name = model.name; aEdit.price = model.price; db.SaveChanges(); } }
public ActionResult Edit(ModelTypeRents model) { _repositorytyperents.EditTypeRent(model); return(RedirectToAction("Index")); }