Exemplo n.º 1
0
        public bool AddListoidToList(Listoid listoid)
        {
            _context.Listoids.Add(listoid);
            int result = _context.SaveChanges();

            return(result == 0);
        }
Exemplo 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);
        }