/// <summary> /// Отправить сообщение с товаром который выбрал Администратор /// </summary> /// <returns></returns> private async Task <IActionResult> SendProductAdminMsg(int MessageId = 0) { BotMessage = new ProductFuncMessage(ProductId); await SendMessage(BotMessage.BuildMsg(), MessageId); return(OkResult); }
/// <summary> /// Показать доп кнопки редактора товара /// </summary> /// <returns></returns> private async Task <IActionResult> SendMoreFunctionButton() { ProductFuncMessage ProductFuncMsg = new ProductFuncMessage(ProductId); await EditInlineReplyKeyboard(ProductFuncMsg.MoreBtn()); return(OkResult); }
private async Task <IActionResult> SendProductFunc(Product product, int MessageId = 0) { if (product != null) { BotMessage = new ProductFuncMessage(product); var mess = BotMessage.BuildMsg(); await SendMessage(mess, MessageId); return(OkResult); } else { return(OkResult); } }
/// <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) { BotMessage = new ProductFuncMessage(product.Id); return(product.Id); } else { return(0); } } }
private async Task <IActionResult> UpdPhoto() { ProductFunction = new ProductFunction(); string product_name = OriginalMessage.Substring(UploadImageForceReply.Length); Product = ProductFunction.GetProduct(product_name); int ProductId = -1; if (base.PhotoId != null && Product != null) { int FsId = await InsertToAttachmentFs(base.PhotoId); Product = ProductFunction.UpdateMainPhoto(Product.Id, FsId); AttachmentTelegramFunction.AddAttachmentTelegram(FsId, base.BotInfo.Id, base.PhotoId); ProductFunction.Dispose(); ProductId = Product.Id; } if (Product != null) // удалось загрузить файл { ProductFuncMsg = new ProductFuncMessage(Product); await SendMessage(ProductFuncMsg.BuildMsg()); } else { await SendMessage(new BotMessage { TextMessage = "Не удалось загрузить файл!" }); ProductFuncMsg = new ProductFuncMessage(ProductId); await SendMessage(ProductFuncMsg.BuildMsg()); } return(OkResult); }