Ejemplo n.º 1
0
        public async Task <IActionResult> Put([FromBody] UpdatePriceEntity updatePrice)
        {
            try
            {
                var result = await Task <int> .Run(() => business_Repo.UpdateItemPrice(updatePrice));

                if (result > 0)
                {
                    await messagePublisher.SendMessageAsync(new UpdatePriceEntity
                    {
                        TblMenuId       = updatePrice.TblMenuId,
                        TblRestaurantId = updatePrice.TblRestaurantId,
                        Price           = updatePrice.Price
                    });

                    return(Ok("Price Updated Successfully"));
                }

                return(this.BadRequest("Failed to update , please try again later"));
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 2
0
        public async Task SendMessageAsync(UpdatePriceEntity updatepricemessage)
        {
            ITopicClient topicClient;

            topicClient = new TopicClient(ServiceBusConnectionString, TopicName);

            string  data    = JsonConvert.SerializeObject(updatepricemessage);
            Message message = new Message(Encoding.UTF8.GetBytes(data));

            try
            {
                await topicClient.SendAsync(message);
            }
            catch (Exception e)
            {
                throw e;
            }
        }
        public decimal UpdateItemPrice(UpdatePriceEntity updatePrice)
        {
            DataLayer.EntityFrameWorkModel.TblOffer tblOffer = mapper.Map <DataLayer.EntityFrameWorkModel.TblOffer>(updatePrice);
            try
            {
                if (updatePrice != null)
                {
                    return(search_Repository.UpdateMenuPrice(tblOffer));
                }
                else
                {
                    return(0);
                }
            }

            catch (Exception e)
            {
                throw e;
            }
        }
Ejemplo n.º 4
0
        public async Task SendMessageAsync(UpdatePriceEntity updatepricemessage)
        {
            ITopicClient topicClient;

            topicClient = new TopicClient(_configuration.GetConnectionString("ServiceBusConnectionString"), TOPIC_PATH);

            string  data    = JsonConvert.SerializeObject(updatepricemessage);
            Message message = new Message(Encoding.UTF8.GetBytes(data));

            message.UserProperties["messageType"] = typeof(UpdatePriceEntity).Name;

            try
            {
                await topicClient.SendAsync(message);
            }
            catch (Exception e)
            {
                throw e;
            }
        }