public IHttpActionResult Get([FromUri] StudyProgrammeFilter filter)
 {
     try
     {
         List <StudyProgrammeModel> list = repository.GetAll(filter).Select(MapEntityToModel).OrderBy(s => s.Id).ToList();
         var content = new EntitiesListResult <StudyProgrammeModel>
         {
             Data     = list,
             Page     = -1,
             PageSize = -1
         };
         ;
         content.Total = list.Count;
         return(Ok(content));
     }
     catch (Exception e)
     {
         return(HandleException(e));
     }
 }
        public List <StudyProgramme> GetAll(StudyProgrammeFilter filter)
        {
            IEnumerable <StudyProgramme> result = base.GetAll();

            if (filter == null)
            {
                return(result.ToList());
            }

            if (!string.IsNullOrEmpty(filter.Title))
            {
                result = result.Where(s => s.Title.ToUpperInvariant().Contains(filter.Title.ToUpperInvariant()));
            }
            if (!string.IsNullOrEmpty(filter.Department))
            {
                result = result.Where(s => s.Department?.Title?.ToUpperInvariant().Contains(filter.Department.ToUpperInvariant()) ?? false);
            }
            if (!string.IsNullOrEmpty(filter.Direction))
            {
                result = result.Where(s => s.Direction?.Title?.ToUpperInvariant().Contains(filter.Direction.ToUpperInvariant()) ?? false);
            }
            return(result.ToList());
        }