示例#1
0
        public async Task <ActionResult <IEnumerable <AlertModel> > > GetAlertsByUser(Guid userId)
        {
            try
            {
                var alerts = await _repo.GetAlertsByUser(userId);

                if (alerts == null)
                {
                    return(NotFound());
                }
                else
                {
                    return(_mapper.Map <List <AlertModel> >(alerts));
                }
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
示例#2
0
        public async Task GetUserAlerts(Guid userId)
        {
            var alerts = await _alertRepository.GetAlertsByUser(userId);

            await Clients.User(userId.ToString()).SendAsync("getUserAlerts", alerts);
        }