[HttpPost] // This controller method is used to post contentdetails from client side to the database passed through API-Gateway. public Task <int> Create([FromBody] ContentDto item2) { Console.WriteLine("token" + item2.TokenString); var contentDetailsPost = _mapper.Map <UserContentDetails>(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.Create(contentDetailsPost));//Service used for post operation. } catch (Exception ex) { Console.WriteLine(ex.Message); } } } return(null); }
public Task <int> Create([FromBody] UserContentDetails item) { return(_service.Create(item)); }