public void AddUserToGroupChat(string userId, int groupChatId) { var groupChat = groupChatRepository.GetById(groupChatId); var user = userRepository.GetByIdUser(userId); user.GroupChats.Add(groupChat); groupChat.Users.Add(user); dataContext.SaveChanges(); }
public void AddGroupChatToGroup(int groupId, int groupChatId) { var groupChat = groupChatRepository.GetById(groupChatId); var group = groupRepository.GetById(groupId); group.GroupChat = groupChat; dataContext.SaveChanges(); }
public void AddViewToGroupChat([FromBody] View view, int groupChatId) { var groupChatViewsList = groupChatRepository.GetById(groupChatId).Views; viewRepository.Add(view); viewRepository.SaveChanges(view); groupChatViewsList.Add(view); dataContext.SaveChanges(); }
public void AddGroupMessage([FromBody] GroupMessage groupMessage, [FromUri] int chatId) { var groupChat = groupChatRepository.GetById(chatId); var messagesInGroupChat = groupChat.GroupMessages; groupMessageRepository.Add(groupMessage); groupMessageRepository.SaveChanges(groupMessage); messagesInGroupChat.Add(groupMessage); dataContext.SaveChanges(); }