Esempio n. 1
0
 public IActionResult GetGroupInformation(string groupId)
 {
     try
     {
         return(Json(_source.GetGroupInfo(groupId)));
     }
     catch
     {
         return(StatusCode(500));
     }
 }
        public IActionResult SendGroupInviteToUser([FromBody] GroupInviteContract message)
        {
            var user = _userSource.GetUserByUserName(message.RecipientUserName);

            if (user == null)
            {
                return(StatusCode(404));
            }
            var m     = message.ToGroupInviteMessage();
            var group = _groupSource.GetGroupInfo(message.GroupId);

            m.SenderId    = HttpContext.User.Id();
            m.RecipientId = user.UserId;
            m.Subject     = "Group Invite: " + group.GroupName;
            m.Body        = "You have been invited to " + group.GroupName + ". Click 'Accept' to be added to this group!";
            _messageSource.SendMessage(m);

            return(StatusCode(200));
        }