private List <Boat> GetAllBoats() { using (var context = new BoatContext()) { var service = new BoatService(context); var boats = service.GetAll(); return(boats.ToList()); } }
public ActionResult DeleteConfirmed(int id) { Boat boat = GetAllBoats().Find(b => b.Id == id); using (var context = new BoatContext()) { var service = new BoatService(context); service.Remove(boat); } return(RedirectToAction("Index")); }
public ActionResult Create(PocoClasses.Entries.Boat newBoat, string returnUrl) { Mapper.Initialize(cfg => cfg.CreateMap <PocoClasses.Entries.Boat, Boat>()); Boat boat = Mapper.Map <Boat>(newBoat); if (ModelState.IsValid) { using (var context = new BoatContext()) { var service = new BoatService(context); service.Add(boat); } return(Redirect(returnUrl)); } return(View(newBoat)); }
public BoatService(BoatContext boatContext) { _boatContext = boatContext; }
public RentService(BoatContext context) { this.context = context; }
public BoatRegisterService(BoatContext context) { this.context = context; }
public BoatRepository(BoatContext db) { this.db = db; }
public CategoryRepository(BoatContext db) { this.db = db; }