//public async Task RegisterChild(BillItemFragment billItemFragment) //{ // await InvokeAsync(StateHasChanged); //} protected async Task HandleSubmit() { if (BillVMEditContext.Validate()) { await BillService.AddOrUpdate(BillHeadVM); ShowDialog = false; await CloseEventCallback.InvokeAsync(true); } await InvokeAsync(StateHasChanged); }
public ActionResult AddOrUpdate(Bill bill) { try { var logoName = Path.GetFileName(bill.file.FileName); var folderPath = Server.MapPath("~/images/bills"); if (!Directory.Exists(folderPath)) { Directory.CreateDirectory(folderPath); } var path = Path.Combine(folderPath, logoName); bill.file.SaveAs(path); bill.Attachment = "/images/bills/" + logoName; } catch (System.Exception) { } try { bill.Bill_Items = JsonConvert.DeserializeObject <List <Bill_Item> >(Request.Form["Bill_Items"]); billService.AddOrUpdate(bill); var responseModel = new ResponseModel { StatusCode = (int)HttpStatusCode.OK, MessageAr = bill.Id > 0 ? AppResource.UpdatedSuccessfully : AppResource.SavedSuccessfully }; return(Json(responseModel, JsonRequestBehavior.AllowGet)); } catch (System.Exception) { var responseModel = new ResponseModel { StatusCode = (int)HttpStatusCode.InternalServerError, MessageAr = AppResource.ChangesNotSaved }; return(Json(responseModel, JsonRequestBehavior.AllowGet)); } }