Example #1
0
        public IEnumerable <Berth> GetNotReservedBerths(int marinaId, DateTime checkIn, DateTime checkOut)
        {
            IBerthRepository repository      = HttpContext.RequestServices.GetService(typeof(BerthRepository)) as BerthRepository;
            var          listOfReservedBeths = repository.GetReservedBerthsByMarinaIdAndDates(marinaId, checkIn, checkOut);
            var          listOfBerths        = repository.GetAllBerthsByMarinaId(marinaId);
            List <Berth> listofFreeBerths    = new List <Berth>();

            HashSet <int> reservedBerthsIds = new HashSet <int>();

            foreach (var berth in listOfReservedBeths)
            {
                reservedBerthsIds.Add(berth.BerthId);
            }
            return(Methods.getFreeBerths(listOfBerths, reservedBerthsIds));
            //return listofFreeBerths;
        }
Example #2
0
        public void Delete(int berthId)
        {
            IBerthRepository repository = HttpContext.RequestServices.GetService(typeof(BerthRepository)) as BerthRepository;

            repository.DeleteBerth(berthId);
        }
Example #3
0
        public Berth GetSpecificBerthForSpecificMarina(int marinaId, int berthId)
        {
            IBerthRepository repository = HttpContext.RequestServices.GetService(typeof(BerthRepository)) as BerthRepository;

            return(repository.GetBerthByIdAndMarinaId(marinaId, berthId));
        }
Example #4
0
        public IEnumerable <Berth> GetAllForSpecificMarina(int id)
        {
            IBerthRepository repository = HttpContext.RequestServices.GetService(typeof(BerthRepository)) as BerthRepository;

            return(repository.GetAllBerthsByMarinaId(id));
        }
Example #5
0
        public IEnumerable <Berth> GetAll()
        {
            IBerthRepository repository = HttpContext.RequestServices.GetService(typeof(BerthRepository)) as BerthRepository;

            return(repository.GetAllBerths());
        }
Example #6
0
        public void Post([FromBody] Berth berth)
        {
            IBerthRepository repository = HttpContext.RequestServices.GetService(typeof(BerthRepository)) as BerthRepository;

            repository.CreateBerth(berth);
        }