public IHttpActionResult GetAll(FilterNotificationType filter)
        {
            if (filter == null)
            {
                filter             = new FilterNotificationType();
                filter.PageSize    = 25;
                filter.CurrentPage = 1;
            }
            var response = repository.GetAllNotificationType(filter);

            return(Ok <DataResponse <EntityList <EntityNotificationType> > >(response));
        }
        public DataResponse <EntityList <EntityNotificationType> > GetAllNotificationType(FilterNotificationType filter, int take = 10, int skip = 0)
        {
            var response = new DataResponse <EntityList <EntityNotificationType> >();

            try
            {
                base.DBInit();

                if (filter != null)
                {
                    take = filter.Take;
                    skip = filter.Skip;
                }
                var query = DBEntity.LookupNotificationTypes.Where(a => 1 == 1);
                if (!string.IsNullOrEmpty(filter.KeyWords))
                {
                    query = query.Where(ua => ua.Title.ToLower().Contains(filter.KeyWords.ToLower()) || ua.NotificationKey.ToLower().Contains(filter.KeyWords.ToLower()));
                }

                var selectQuery = query.Select(a => new EntityNotificationType
                {
                    Id              = a.Id,
                    Title           = a.Title,
                    NotificationKey = a.NotificationKey,
                    CreatedUser     = a.User.FirstName,
                    CreatedOn       = a.CreatedOn,
                    Updateduser     = a.User1 == null ? null : a.User1.FirstName,
                    UpdatedOn       = a.UpdatedOn
                });

                if (string.IsNullOrEmpty(filter.SortKey) || string.IsNullOrEmpty(filter.SortOrder))
                {
                    selectQuery = selectQuery.OrderByDescending(o => o.CreatedOn);
                }
                else
                {
                    string orderBy = string.Format("{0} {1}", filter.SortKey, filter.SortOrder);
                    selectQuery = selectQuery.OrderBy(orderBy);
                }

                response = GetList <EntityNotificationType>(selectQuery, skip, take);
            }
            catch (Exception ex)
            {
                ex.Log();
            }
            finally
            {
                base.DBClose();
            }
            return(response);
        }