Ejemplo n.º 1
0
        public ListModel <Insurance> List([FromBody] ListQueryModel <InsuranceListQueryModel> listQuery)
        {
            if (listQuery == null)
            {
                listQuery = new ListQueryModel <InsuranceListQueryModel>();
            }
            if (listQuery.Model == null)
            {
                listQuery.Model = new InsuranceListQueryModel();
            }
            listQuery.Model.OwnerId = _branchContext.Branch.Id;

            if (listQuery.Model.EndDate.HasValue)
            {
                listQuery.Model.EndDate = listQuery.Model.EndDate.Value.Date.AddHours(23).AddMinutes(59).AddSeconds(59);
            }

            return(new ListModel <Insurance>
            {
                List = _insuranceRepository.List(listQuery, listQuery.Model),
                Count = _insuranceRepository.Count(listQuery, listQuery.Model)
            });
        }