// POST: api/Genero
        public IHttpActionResult Post([FromBody] GeneroModel value)
        {
            try
            {
                if (value == null)
                {
                    throw new Exception("Json invalido.");
                }

                Genero g = value.ToEntity();
                //--------   Service Bus
                var message = new Message(Encoding.Default.GetBytes(VideoLocadoraHelperToJson.ToJson(g)));
                _Queue = new QueueClient(_CONNECTION_STRING, _NAME_QUEUE);

                _Queue.SendAsync(message);
                //--------
                //_generoAppService.Adicionar(g);
                return(Ok());
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
Пример #2
0
        public void SetCache(string key, object value)
        {
            var valueString = VideoLocadoraHelperToJson.ToJson(value);

            GetRedisCache().StringSet(key, valueString);
        }