示例#1
0
        public ActionResult GetCFTypeUnseen()
        {
            string          authHeader = this.HttpContext.Request.Headers["Authorization"];
            TokenModel      tokenModel = new TokenModel();
            ClaimsPrincipal auth       = tokenModel.GetPrincipal(authHeader);

            if (auth.Identity.IsAuthenticated)
            {
                AspNetUsers users = new AspNetUsers();
                string      id    = users.getUserId(auth.Identity.Name);
                using (FinPlannerContext _context = new FinPlannerContext())
                {
                    List <string> collections = _context
                                                .UserCollectionMapping
                                                .Where(x => x.Id == id)
                                                .Select(x => x.CollectionsId)
                                                .ToList();
                    List <CFType> types = new List <CFType>();
                    foreach (string item in collections)
                    {
                        CFType type = new CFType();
                        types.AddRange(type.GetCFList(item));
                    }
                    types = types
                            .GroupBy(x => x.Id)
                            .Select(g => g.First())
                            .ToList();
                    return(Ok(types));
                }
            }
            return(Ok(""));
        }
示例#2
0
        public ActionResult GetCFType(string collectionsId)
        {
            string          authHeader = this.HttpContext.Request.Headers["Authorization"];
            TokenModel      tokenModel = new TokenModel();
            ClaimsPrincipal auth       = tokenModel.GetPrincipal(authHeader);

            if (auth.Identity.IsAuthenticated)
            {
                new ClickTracker("GetCFType", true, false, "collectionsId " + collectionsId, auth.Identity.Name);
                CFType cf = new CFType();
                return(Ok(cf.GetCFList(collectionsId).Where(x => x.Id != "39a1d903-f4e3-4e4a-986a-604bd8dff20e")));
            }
            return(Ok(""));
        }