public Task <bool> DeleteFile(int fileId, int contentId, [FromBody] FileIdDto item2) { Console.WriteLine("token" + item2.TokenString); var FilesDetailsDelete = _mapper.Map <UserFileDetails>(item2); AuthenticationTokenClass AuthenticationTokenClassObjRef = new AuthenticationTokenClass(); TokenDto tokendto = new TokenDto(); string tokenref = AuthenticationTokenClassObjRef.AuthenticationToken(tokendto).Result; object jsonObject = JsonConvert.DeserializeObject(tokenref); var ParsedJsonObject = JObject.Parse(tokenref); string tokenserver = ParsedJsonObject["tokenstored"].ToString(); dynamic dynJson = JsonConvert.DeserializeObject(tokenserver); foreach (var item in dynJson) { String tokenstored = item.tokenstored; if (item2.TokenString == tokenstored) { try { return(_service.DeleteFile(fileId, contentId, FilesDetailsDelete)); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } return(null); }
[HttpPut("{fileId}/{contentId}")] //Delete File corresponding to fileId by updating (IsDelete=true). public Task <bool> DeleteFile(int fileId, int contentId, [FromBody] UserFileDetails item) { return(_service.DeleteFile(fileId, contentId, item)); }