コード例 #1
0
        public void UpdatePage(ApiLatestUpdateModel model, int currentPage)
        {
            var result = _GetByFilter(model).FirstOrDefault();

            result.CurrentPages = currentPage;
            this.db.SaveChanges();
        }
コード例 #2
0
        /// <summary>
        /// 一定會有資料回傳,否則throw exception
        /// </summary>
        /// <param name="apiName"></param>
        /// <param name="methodName"></param>
        /// <returns></returns>
        public ApiLatestUpdateModel GetApiLatestUpdateModel(string apiName, string methodName)
        {
            var filter = new ApiLatestUpdateModel {
                ApiName = apiName, MethodName = methodName
            };

            return(filter);
        }
コード例 #3
0
        public bool IsLatest(ApiLatestUpdateModel latestData, int totalPages)
        {
            if (latestData.TotalPages == totalPages)
            {
                return(true);
            }

            ApiLatestUpdateRepository.UpdateTotalPage(latestData, totalPages);
            return(false);
        }
コード例 #4
0
        private IEnumerable <ApiLatestUpdate> _GetByFilter(ApiLatestUpdateModel model)
        {
            IQueryable <ApiLatestUpdate> iq = this.db.ApiLatestUpdates;

            if (!string.IsNullOrWhiteSpace(model.ApiName))
            {
                iq = iq.Where(m => m.ApiName == model.ApiName);
            }

            if (!string.IsNullOrWhiteSpace(model.MethodName))
            {
                iq = iq.Where(m => m.MethodName == model.MethodName);
            }

            return(iq);
        }
コード例 #5
0
 public List <ApiLatestUpdateModel> GetByFilter(ApiLatestUpdateModel model)
 {
     return(_GetByFilter(model)
            .Select(m => m.ReturnInjectObjectNullable <ApiLatestUpdateModel>())
            .ToList());
 }