Ejemplo n.º 1
0
        public ActionResult Subscribe(int eventId, [FromBody] EventSubscriptionModel model)
        {
            // O ideal aqui é verificar se existem tanto o evento quanto o subscriber na base
            // e retornar BadRequest explicando caso um dos dois não exista
            _eventService.Subscribe(model.SubscriberId, eventId);

            return(Ok());
        }
Ejemplo n.º 2
0
        public void LoadSubscriptions(bool forceLoad = false)
        {
            if (_events == null || forceLoad)
            {
                lock (_lockobj)
                {
                    _events = new List <EventSubscriptionModel>();

                    var data = _dbProxy.Get(CommonConst.Collection.EVENT_SUBSCRIPTION, CommonConst.Filters.IS_OVERRIDE_FILTER);
                    foreach (var item in data)
                    {
                        EventSubscriptionModel eventModel = Newtonsoft.Json.JsonConvert.DeserializeObject <EventSubscriptionModel>(item.ToString());
                        _events.Add(eventModel);
                    }
                }
            }
        }