コード例 #1
0
        /// <summary>
        /// get all qp lead priority
        /// </summary>
        /// <param name="stats">include contact statistics for each qp</param>
        /// <returns></returns>
        public IHttpActionResult Get(bool stats = false)
        {
            var leadPerson = _leadPersonalService.Repository.Include(x => x.LeadGroup, x => x.Leads);

            var converter = new CustomJsonConverter(new AllocationJsonResolver(),
                Configuration.Formatters.JsonFormatter.SerializerSettings);

            if (stats)
            {
                var personStats = _leadPersonalService.StatsProvider.GetStats(leadPerson);
                var groups = _leadPersonalService.GetLeadGroup();

                var resolved = converter.ResolveArray(leadPerson);

                return Ok(new
                {
                    data = new
                    {
                        persons = converter.ResolveArray(leadPerson),
                        stats = personStats,
                        groups = groups
                    }
                });
            }

            return Ok(new
            {
                data = converter.ResolveArray(leadPerson)
            });
        }
コード例 #2
0
        public IHttpActionResult Get(int id)
        {
            var siteGroup=_siteGroupService.Repository.Get(id);
            if (siteGroup == null) return NotFound();

            var converter = new CustomJsonConverter(new SiteGroupJsonResolver(),
                Configuration.Formatters.JsonFormatter.SerializerSettings);
            var data = converter.ResolveObject(siteGroup);
            return Ok(new
            {
                data = data
            });
        }
コード例 #3
0
 public IHttpActionResult SearchSiteGroup(string type=null, string code=null)
 {
     var groups = _siteGroupService.Search(type, code);
     var converter = new CustomJsonConverter(new SiteGroupJsonResolver(),
         Configuration.Formatters.JsonFormatter.SerializerSettings);
     return Ok(new
     {
         data = converter.ResolveArray(groups)
     });
 }