private async Task <IActionResult> UpdPrice() { ProductFunction = new ProductFunction(); string product_name = OriginalMessage.Substring(EnterPriceForceReply.Length); var product = ProductFunction.GetProduct(product_name); try { double price = Convert.ToDouble(ReplyToMessageText); if (price > 0 && product != null) { product = ProductFunction.UpdatePrice(product.Id, price, Convert.ToInt32(BotInfo.Configuration.CurrencyId)); ProductFunction.Dispose(); return(await SendForceReplyMessage(StockValueForceReply + product.Name)); } else { return(await SendTextMessageAndForceReply(product.Name + "Ошибка! Значение должно быть больше 0", EnterPriceForceReply + product.Name)); } } catch { return(await SendTextMessageAndForceReply(product_name + "Ошибка! Неверный формат данных", EnterPriceForceReply + product_name)); } }
/// <summary> /// Обновить стоимость /// </summary> /// <returns></returns> private async Task <IActionResult> UpdateProductPrice() { double NewPrice = 0.0; try { int ProductId = ProductGet(ProductEditPriceRelpy); ProductFunction = new ProductFunction(); NewPrice = Convert.ToDouble(base.ReplyToMessageText); var product = ProductFunction.UpdatePrice(ProductId, NewPrice, Convert.ToInt32(BotInfo.Configuration.CurrencyId)); ProductFunction.Dispose(); return(await SendProductFunc(product)); } catch { return(await ErrorMessage(ProductEditPriceRelpy)); } }