Exemplo n.º 1
0
        public async Task <IActionResult> PutXSubscription([FromRoute] Guid id, [FromBody] XSubscription varXSubscription)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != varXSubscription.XSubscriptionId)
            {
                return(BadRequest());
            }

            _context.Entry(varXSubscription).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!XSubscriptionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 2
0
        public void Unsubscribe(string @event, string controller)
        {
            var sub = new XSubscription {
                Event = @event, Confirm = false
            };
            var jsonSub = this.Serializer.Serialize(sub);
            var json    = this.Serializer.Serialize(new Model.Message(jsonSub, Constants.PubSub.Unsubscribe, controller));

            this.Socket.Send(new XDataFrame(json).ToBytes());
        }
Exemplo n.º 3
0
        public async Task <IActionResult> PostXSubscription([FromBody] XSubscription varXSubscription)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            _context.XSubscription.Add(varXSubscription);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetXSubscription", new { id = varXSubscription.XSubscriptionId }, varXSubscription));
        }