public void UpdatePage(ApiLatestUpdateModel model, int currentPage) { var result = _GetByFilter(model).FirstOrDefault(); result.CurrentPages = currentPage; this.db.SaveChanges(); }
/// <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); }
public bool IsLatest(ApiLatestUpdateModel latestData, int totalPages) { if (latestData.TotalPages == totalPages) { return(true); } ApiLatestUpdateRepository.UpdateTotalPage(latestData, totalPages); return(false); }
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); }
public List <ApiLatestUpdateModel> GetByFilter(ApiLatestUpdateModel model) { return(_GetByFilter(model) .Select(m => m.ReturnInjectObjectNullable <ApiLatestUpdateModel>()) .ToList()); }