예제 #1
0
        protected override void Constructor()
        {
            try
            {
                CategoryListMsg = new CategoryListMessage(AdminProductInCategoryCmd);

                if (base.Argumetns != null && base.Argumetns.Count > 0)
                {
                    ProductId = base.Argumetns[0];
                }

                if (this.ProductId > 0)
                {
                    using (MarketBotDbContext db = new MarketBotDbContext())
                        ProductName = db.Product.Where(p => p.Id == ProductId).FirstOrDefault().Name;

                    UnitListMsg = new UnitListMessage(this.ProductId);

                    CurrencyListMsg = new CurrencyListMessage(this.ProductId);

                    AdminProductListMsg = new AdminProductListMessage(this.ProductId);

                    AdminProductFuncMsg = new AdminProductFuncMessage(this.ProductId);
                }
            }

            catch
            {
            }
        }
        /// <summary>
        /// Сообщение со списоком ед. измерения
        /// </summary>
        /// <returns></returns>
        public async Task <IActionResult> SendUnitList()
        {
            try
            {
                BotMessage = new UnitListMessage(ProductId);
                if (await EditMessage(BotMessage.BuildMsg()) != null)
                {
                    return(OkResult);
                }

                else
                {
                    return(OkResult);
                }
            }

            catch
            {
                return(OkResult);
            }
        }