Exemplo n.º 1
0
 private List <Boat> GetAllBoats()
 {
     using (var context = new BoatContext())
     {
         var service = new BoatService(context);
         var boats   = service.GetAll();
         return(boats.ToList());
     }
 }
Exemplo n.º 2
0
        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"));
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
 public BoatService(BoatContext boatContext)
 {
     _boatContext = boatContext;
 }
Exemplo n.º 5
0
 public RentService(BoatContext context)
 {
     this.context = context;
 }
Exemplo n.º 6
0
 public BoatRegisterService(BoatContext context)
 {
     this.context = context;
 }
Exemplo n.º 7
0
 public BoatRepository(BoatContext db)
 {
     this.db = db;
 }
Exemplo n.º 8
0
 public CategoryRepository(BoatContext db)
 {
     this.db = db;
 }