protected override void Constructor() { try { AdminQiwiSettingsMsg = new AdminQiwiSettingsMessage(); AdminCmdListMsg = new AdminPanelCmdMessage(base.FollowerId); CategoryListMsg = new CategoryListMessage(AdminProductInCategoryCmd); ContactEditMsg = new ContactEditMessage(); AdminAllProductsViewMsg = new AdminAllProductsViewMessage(); AdminCurrentStockMsg = new AdminCurrentStockMessage(); AdminPayMethodsSettingsMsg = new AdminPayMethodsSettings(); AdminControlMsg = new AdminControlMessage(); StatisticMsg = new StatisticMessage(); AvailableCitiesMsg = new AvailableCitiesMessage(); if (base.Argumetns.Count > 0) { Parametr = base.Argumetns[0]; AdminProductListMsg = new AdminProductListMessage(this.Parametr); AdminProductFuncMsg = new AdminProductFuncMessage(Parametr); } } catch { } }
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> /// <param name="ReplyName"></param> /// <returns></returns> private int ProductGet(string ReplyName) { using (MarketBotDbContext db = new MarketBotDbContext()) { ProductName = OriginalMessage.Substring(ReplyName.Length); var product = db.Product.Where(p => p.Name == ProductName).FirstOrDefault(); if (product != null) { AdminProductFuncMsg = new AdminProductFuncMessage(product.Id); return(product.Id); } else { return(0); } } }
/// <summary> /// Отправить сообщение с админскими функциями для товара /// </summary> /// <param name="product"></param> /// <param name="MessageId"></param> /// <returns></returns> private async Task <IActionResult> SendProductFunc(Product product, int MessageId = 0) { if (product != null) { AdminProductFuncMsg = new AdminProductFuncMessage(product.Id); if (await SendMessage(AdminProductFuncMsg.BuildMessage(), MessageId) != null) { return(OkResult); } else { return(NotFoundResult); } } else { return(NotFoundResult); } }