public List <BoatStatusLogDto> SearchBoatStatusLog(BoatStatusLogSearchParameter searchParam) => _uow.Uow(uow =>
        {
            var entities = uow.BoatStatusLogRepository.Search(searchParam).ToList();
            var dtos     = _mapper.Map <List <BoatStatusLog>, List <BoatStatusLogDto> >(entities);

            return(dtos);
        });
        public IQueryable <BoatStatusLog> Search(BoatStatusLogSearchParameter search)
        {
            var query = Context.Set <BoatStatusLog>().AsQueryable();

            if (search == null)
            {
                return(query);
            }

            if (!string.IsNullOrEmpty(search.BoatName))
            {
                query = query.Where(bsl => bsl.BoatName.Contains(search.BoatName));
            }
            if (search.RemovalOfServiceStartDate.HasValue)
            {
                query = query.Where(bsl => bsl.RemovalOfServiceDate.HasValue && bsl.RemovalOfServiceDate.Value >= search.RemovalOfServiceStartDate.Value);
            }
            if (search.RemovalOfServiceEndDate.HasValue)
            {
                query = query.Where(bsl => bsl.RemovalOfServiceDate.HasValue && bsl.RemovalOfServiceDate.Value <= search.RemovalOfServiceEndDate.Value);
            }
            if (!string.IsNullOrEmpty(search.Comments))
            {
                query = query.Where(bsl => bsl.Comments.Contains(search.Comments));
            }
            if (search.ReturnToServiceStartDate.HasValue)
            {
                query = query.Where(bsl => bsl.ReturnToServiceDate.HasValue && bsl.ReturnToServiceDate.Value >= search.ReturnToServiceStartDate.Value);
            }
            if (search.ReturnToServiceEndDate.HasValue)
            {
                query = query.Where(bsl => bsl.ReturnToServiceDate.HasValue && bsl.ReturnToServiceDate.Value <= search.ReturnToServiceEndDate.Value);
            }
            if (!string.IsNullOrEmpty(search.CommentOnReturn))
            {
                query = query.Where(bsl => bsl.CommentOnReturn.Contains(search.CommentOnReturn));
            }

            return(query);
        }
Exemplo n.º 3
0
        public List <BoatStatusLogDto> LoadBoatStatusLogSearch([FromBody] BoatStatusLogSearchParameter searchParam)
        {
            var results = VesperLogBookService.SearchBoatStatusLog(searchParam);

            return(results);
        }