public void TweetTagMap(int tweetId, IList <int> tagIdParam) { mapper = new PostTagMapOperation(); PostTagMapDto mapperDto = new PostTagMapDto(); mapperDto.postId = tweetId; mapperDto.tagIdList = tagIdParam; mapper.Add(mapperDto); }
/// <summary> /// Updates the specified post identifier. /// </summary> /// <param name="postId">The post identifier.</param> /// <param name="newList">The new list.</param> /// <returns></returns> public int Update(int postId, IList <int> newList) { Remove(postId); PostTagMapDto newPost = new PostTagMapDto(); newPost.postId = postId; newPost.tagIdList = newList; Add(newPost); return(0); }
/// <summary> /// Adds the specified mapper. /// </summary> /// <param name="mapper">The mapper.</param> /// <returns></returns> public int Add(PostTagMapDto mapper) { PostTagMap map = new PostTagMap(); // int postId = mapper.postId; // map.Post_id = postId; foreach (var item in mapper.tagIdList) { map.Post_id = mapper.postId; map.Tag_id = item; glitterDb.PostTagMaps.Add(map); glitterDb.SaveChanges(); } return(0); }