Ejemplo n.º 1
0
        public ActionResult AssigningSharedCollection([FromBody] JsonElement json)
        {
            string          authHeader = this.HttpContext.Request.Headers["Authorization"];
            TokenModel      tokenModel = new TokenModel();
            ClaimsPrincipal auth       = tokenModel.GetPrincipal(authHeader);

            if (auth.Identity.IsAuthenticated)
            {
                new ClickTracker("AssigningSharedCollection", false, true, json.GetRawText(), auth.Identity.Name);
                NewCollectionsObj obj     = JsonConvert.DeserializeObject <NewCollectionsObj>(json.GetRawText());
                CollectionSharing sharing = new CollectionSharing();
                return(Ok(sharing.AddUserToCollection(obj)));
            }
            return(Ok(""));
        }
Ejemplo n.º 2
0
        public ActionResult SetSharedCollection(string collectionId)
        {
            string          authHeader = this.HttpContext.Request.Headers["Authorization"];
            TokenModel      tokenModel = new TokenModel();
            ClaimsPrincipal auth       = tokenModel.GetPrincipal(authHeader);

            if (auth.Identity.IsAuthenticated)
            {
                new ClickTracker("SetSharedCollection", false, true, "collectionId " + collectionId, auth.Identity.Name);
                CollectionSharing collectionSharing = new CollectionSharing(collectionId);
                return(Ok(new ReturnModel()
                {
                    result = true, returnStr = collectionSharing.CollectionSharingId
                }));
            }
            return(Ok(""));
        }