/// <summary> /// Обновить главную фотографию товара /// </summary> /// <returns></returns> private async Task <IActionResult> UpdateMainProductPhoto() { int fs_id = await base.InsertToAttachmentFs(base.PhotoId); int Id = ProductGet(ProductEditPhotoReply); ProductFunction = new ProductFunction(); var product = ProductFunction.UpdateMainPhoto(Id, fs_id); AttachmentTelegramFunction.AddAttachmentTelegram(fs_id, BotInfo.Id, base.PhotoId); ProductFunction.Dispose(); return(await SendProductFunc(product)); }
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); }