protected async Task AddNewCoupon() { var result = await RegisteredFunction.InvokeAsync <bool>("validateCoupon"); if (result) { if (NewCoupon.Type == (int)Consts.CouponType.Date) { CouponDateStr = MegaService.Util.GetInput <string>("#new-coupon-date"); var parseResult = DateTime.TryParse(CouponDateStr, out var dateTime); if (!parseResult) { return; } NewCoupon.DateExpired = dateTime; } NewCoupon.Id = -1; //signify the coupon as not saved yet Product.Coupons.Add(NewCoupon); // TODO: SAVE STUFFIE TO SERVER HERE var saveResult = await MegaService.Fetcher.Fetch("/api/product/AddCoupon/", new { Product.Id, Coupon = NewCoupon }); var saveBool = saveResult["Result"].ToObject <bool>(); Toastr(saveBool); NewCoupon = null; StateHasChanged(); } }
public static async Task <string> GetFileData(string fileInputRef) { return((await RegisteredFunction.InvokeAsync <StringHolder>("getFileData", fileInputRef)).Content); //ConsoleLog("C# just received byte[] : " + base64fileContent.Length); //string res = null; //return res; }
public static Task <object> WriteText(string text) { return(RegisteredFunction.InvokeAsync <object>("BlazorClipboard.WriteText", text)); }
private void Confirm(string title, string text, string mode) { RegisteredFunction.InvokeAsync <bool>("sweetAlertConfirm", title, text, mode, true); }
private void Alert(string title, string text, string mode, bool multi) { RegisteredFunction.InvokeAsync <bool>("sweetAlert", title, text, mode); }
public Task <TResult> InvokeAsync <TResult>(string methodName, params object[] args) => RegisteredFunction.InvokeAsync <TResult>(INVOKE_WITH_RESULT_ASYNC_METHOD, this.InternalConnectionId, methodName, args);
public Task InvokeAsync(string methodName, params object[] args) => RegisteredFunction.InvokeAsync <object>(INVOKE_ASYNC_METHOD, this.InternalConnectionId, methodName, args);
public Task StopAsync() => RegisteredFunction.InvokeAsync <object>(STOP_CONNECTION_METHOD, this.InternalConnectionId);