Beispiel #1
0
        private List <Issue> QueryIssueView(string pageStr, string limitStr, string alias, string type, out int total)
        {
            var issues = dal.GetAll <Issue>();
            int page   = Convert.ToInt32(pageStr);
            int limit  = Convert.ToInt32(limitStr);

            IEnumerable <Issue> subIssue = dal.GetAll <Issue>();

            if (alias != null)
            {
                subIssue = from m in subIssue where dal.GetEntities <CodeOwnership>(c => c.Type == "issue" && c.support_alias == alias).Any(x => x.FkId == m.id) == true select m;
            }
            if (type != null)
            {
                subIssue = subIssue.Where(c => (c.Type != null ? c.Type.ToLower().Contains(type.ToLower()) : false));
            }
            total = subIssue.Count();

            if (page != 0 || limit != 0)
            {
                page     = page == 0 ? 1 : page;
                subIssue = subIssue.Skip((page - 1) * limit).Take(limit);
            }

            return(subIssue.ToList());
        }
Beispiel #2
0
        public IHttpActionResult Get()
        {
            var         paras    = ControllerContext.Request.GetQueryNameValuePairs();
            string      page     = paras.Where(c => c.Key == "page").FirstOrDefault().Value;
            string      limit    = paras.Where(c => c.Key == "limit").FirstOrDefault().Value;
            string      product  = paras.Where(c => c.Key == "product").FirstOrDefault().Value;
            string      platform = paras.Where(c => c.Key == "platform").FirstOrDefault().Value;
            string      alias    = paras.Where(c => c.Key == "alias").FirstOrDefault().Value;
            var         codes    = dal.GetAll <Code>();
            int         total;
            List <Code> queryCodes = QueryCodeView(page, limit, product, platform, alias, out total);
            var         pageview   = DAL.DALGenerateView.GetCodeView(queryCodes, total);

            return(Ok(pageview));
        }
Beispiel #3
0
        /// <summary>
        /// sync commit to database
        /// </summary>
        /// <param name="value"></param>
        // POST api/<controller>
        public IHttpActionResult Post()
        {
            var codes = dal.GetAll <Code>();

            foreach (var item in codes)
            {
                GitAPI gitApi = new GitAPI();
                gitApi.GetGitHubCommitObject(item.GitHubUrl).ConvertToCommit(gitApi.CommitBody, item.id).InsertToDatabase(gitApi.Commits, dal, item.GitHubUrl);
            }
            return(Ok());
        }
Beispiel #4
0
        // GET api/<controller>
        public string Get()
        {
            string str = "";

            foreach (var item in dal.GetAll <Process>())
            {
                str += item.name + ",";
            }
            str = str.Substring(0, str.Length - 1);
            return(str);
        }
Beispiel #5
0
        // GET: api/IssueStatus
        public IHttpActionResult Get()
        {
            string str = "";

            foreach (var item in dal.GetAll <IssueStatu>())
            {
                str += item.name + ",";
            }
            str = str.Substring(0, str.Length - 1);

            return(Ok(str));
        }
Beispiel #6
0
        /// <summary>
        /// sync all issues to database
        /// </summary>
        /// <param name="value"></param>
        // POST api/<controller>
        public HttpStatusCodeResult Post()
        {
            if (!ModelState.IsValid)
            {
                var errors = ModelState.Values.SelectMany(v => v.Errors).Select(e => e.Exception);
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest, string.Join(" | ", errors)));
            }
            var codes = dal.GetAll <Code>();

            foreach (var item in codes)
            {
                GitAPI api = new GitAPI();
                api.GetGitHubIssueObject(item.GitHubUrl).ConvertToIssue(api.issueBody, item.id).InsertToDatabase(api.issues, dal);
            }
            return(new HttpStatusCodeResult(HttpStatusCode.OK));
        }
Beispiel #7
0
 // GET api/<controller>
 public IEnumerable <Platform> Get()
 {
     return(dal.GetAll <Platform>());
 }