public IActionResult AddMember(string groupName, [FromBody] string userName) { try { _source.AddUser(groupName, userName); return(Ok()); } catch { return(StatusCode(500)); } }
public void AcceptGroupInvite([FromBody] string messageId) { var userId = HttpContext.User.Id(); var message = _messageSource.GetMessageById(userId, messageId); if (message == null || message.Type != "Group") { return; } var groupInvite = message as GroupInviteMessage; var groupId = groupInvite.GroupId; _groupSource.AddUser(groupId, userId); var user = _userSource.Get(userId); user.Groups.Add(groupId); _userSource.Update(user); _messageSource.DeleteMessage(userId, groupInvite.MessageId); }