Ejemplo n.º 1
0
        public async Task SendAKudo(string connectionid, int kudocount, KudoViewModel kudovm)
        {
            var user = await _userManager.FindByNameAsync(kudovm.username);

            var thelistoid = _listrepo.GetListoidById(kudovm.ListoidId);

            await _listrepo.GiveListoidAKudo(new Kudo
            {
                User    = user,
                listoid = thelistoid,
            }).ContinueWith(delegate {
                if (kudocount > 1)
                {
                    var x = _listrepo.GetActiveList();
                    var listoidViewModel = new ListoidViewModel()
                    {
                        MasterListId = x.MasterListId,
                        Kudos        = 3,
                        MessageBody  = thelistoid.MessageBody,
                        Username     = thelistoid.User.UserName,
                        CreateDate   = thelistoid.CreateDate
                    };
                    Clients.All.SendAsync("NewMasterListItem", listoidViewModel);
                }
            });

            await Clients.Client(connectionid).SendAsync("ReceiveCurrentPurgatoryItems", _listrepo.GetAllPurgatoryItemsForClient());

            await Clients.Client(connectionid).SendAsync("ReceiveCurrentMasterList", _listrepo.GetMasterListName(),
                                                         _listrepo.GetAllCurrentMasterListForClient());
        }
Ejemplo n.º 2
0
        public async Task SendListoid(ChatMessageViewModel message)
        {
            var user = await _userManager.FindByNameAsync(message.Username);

            var currentlist = _listrepo.GetActiveList();

            var listoidToAdd = new Listoid()
            {
                MasterList  = currentlist,
                Kudos       = new List <Kudo>(),
                MessageBody = message.MessageBody,
                User        = user,
                CreateDate  = DateTime.Now
            };

            var listoidViewModel = new ListoidViewModel()
            {
                MasterListId = currentlist.MasterListId,
                Kudos        = 0,
                MessageBody  = message.MessageBody,
                Username     = user.UserName,
                CreateDate   = DateTime.Now
            };

            _listrepo.AddListoidToList(listoidToAdd);

            await Clients.All.SendAsync("NewPurgatoryItem", listoidViewModel);
        }