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; }
public void Delete(int berthId) { IBerthRepository repository = HttpContext.RequestServices.GetService(typeof(BerthRepository)) as BerthRepository; repository.DeleteBerth(berthId); }
public Berth GetSpecificBerthForSpecificMarina(int marinaId, int berthId) { IBerthRepository repository = HttpContext.RequestServices.GetService(typeof(BerthRepository)) as BerthRepository; return(repository.GetBerthByIdAndMarinaId(marinaId, berthId)); }
public IEnumerable <Berth> GetAllForSpecificMarina(int id) { IBerthRepository repository = HttpContext.RequestServices.GetService(typeof(BerthRepository)) as BerthRepository; return(repository.GetAllBerthsByMarinaId(id)); }
public IEnumerable <Berth> GetAll() { IBerthRepository repository = HttpContext.RequestServices.GetService(typeof(BerthRepository)) as BerthRepository; return(repository.GetAllBerths()); }
public void Post([FromBody] Berth berth) { IBerthRepository repository = HttpContext.RequestServices.GetService(typeof(BerthRepository)) as BerthRepository; repository.CreateBerth(berth); }