public async void OnBtnSaveAddContactNeed_Click(object sender, EventArgs e) { if (viewModel.PromotionPrice == null) { await Shell.Current.DisplayAlert(Language.thong_bao, Language.vui_long_nhap_gia_giam, Language.dong); } else { FurnitureUpdate.IsPromotion = true; FurnitureUpdate.PromotionFromDate = viewModel.PromotionFromDate; FurnitureUpdate.PromotionToDate = viewModel.PromotionToDate; FurnitureUpdate.PromotionPrice = viewModel.PromotionPrice; ApiResponse apiResponse = await ApiHelper.Put($"{ApiRouter.FURNITUREPRODUCT_ADD_UPDATE}/update", FurnitureUpdate, true); if (apiResponse.IsSuccess) { await ModalUpdate.Hide(); viewModel.PromotionFromDate = DateTime.Now; viewModel.PromotionToDate = DateTime.Now; viewModel.PromotionPrice = null; CloseModal_Clicked(null, EventArgs.Empty); await viewModel.LoadOnRefreshCommandAsync(); await searchPageResultViewModel.LoadOnRefreshCommandAsync(); ToastMessageHelper.ShortMessage(Language.cap_nhat_thanh_cong); } else { ToastMessageHelper.ShortMessage(apiResponse.Message); } } }
public async void OnBtnCancelAddPromotion_Click(object sender, EventArgs e) { await ModalUpdate.Hide(); //viewModel.CancelPopUpAddContactNeed(); }
public async void OnBtnSavePromotion_Click(object sender, EventArgs e) { if (viewModel.PromotionPrice == null) { await Shell.Current.DisplayAlert(Language.thong_bao, Language.vui_long_nhap_gia_giam, Language.dong); } else { FurnitureProduct product = new FurnitureProduct(); product.Name = FurnitureUpdate.Name; product.ParentCategoryId = FurnitureUpdate.ParentCategoryId; product.CategoryId = FurnitureUpdate.CategoryId; product.CreatedById = Guid.Parse(UserLogged.Id); product.Price = FurnitureUpdate.Price; product.Status = FurnitureUpdate.Status; product.Model = FurnitureUpdate.Model; product.Origin = FurnitureUpdate.Origin; product.Guarantee = FurnitureUpdate.Guarantee; product.Description = FurnitureUpdate.Description; product.Address = FurnitureUpdate.Address; product.Category = FurnitureUpdate.Category; product.Company = FurnitureUpdate.Company; product.CompanyId = FurnitureUpdate.CompanyId; product.AvatarUrl = FurnitureUpdate.AvatarUrl; product.CreatedBy = FurnitureUpdate.CreatedBy; product.DistrictId = FurnitureUpdate.DistrictId; product.Images = FurnitureUpdate.Images; product.Model = FurnitureUpdate.Model; product.ProvinceId = FurnitureUpdate.ProvinceId; product.Street = FurnitureUpdate.Street; product.WardId = FurnitureUpdate.WardId; product.Videos = FurnitureUpdate.Videos; product.ProductStatus = FurnitureUpdate.ProductStatus; product.IsPromotion = true; product.PromotionFromDate = viewModel.PromotionFromDate; product.PromotionToDate = viewModel.PromotionToDate; product.PromotionPrice = viewModel.PromotionPrice; ApiResponse apiResponse = await ApiHelper.Post($"{ApiRouter.FURNITUREPRODUCT_ADD_UPDATE}", product, true); if (apiResponse.IsSuccess) { await ModalUpdate.Hide(); viewModel.PromotionFromDate = DateTime.Now; viewModel.PromotionToDate = DateTime.Now; viewModel.PromotionPrice = null; await viewModel.LoadOnRefreshCommandAsync(); ToastMessageHelper.ShortMessage(Language.dang_thanh_cong); MessagingCenter.Send <PromotionPage>(this, "AddProduct"); await ModalPickProduct.Hide(); } else { ToastMessageHelper.ShortMessage(apiResponse.Message); } } }