Пример #1
0
 public ActionResult Create(ModelTypeRents model)
 {
     if (ModelState.IsValid)
     {
         _repositorytyperents.AddTypeRent(model);
     }
     return(RedirectToAction("Index"));
 }
Пример #2
0
 public void AddTypeRent(ModelTypeRents model)
 {
     using (var db = new DAL.BikeEntities())
     {
         db.TypeRents.Add(MapToDB(model));
         db.SaveChanges();
     }
 }
Пример #3
0
 private DAL.TypeRents MapToDB(ModelTypeRents model)
 {
     return(new DAL.TypeRents()
     {
         id = model.id,
         name = model.name,
         price = model.price
     });
 }
Пример #4
0
 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();
     }
 }
Пример #5
0
 public ActionResult Edit(ModelTypeRents model)
 {
     _repositorytyperents.EditTypeRent(model);
     return(RedirectToAction("Index"));
 }