private async void UpdateBranch() { IRestDataMapper mapper = containerExtension.Resolve <IRestDataMapper>(); if (SelectedBranch != null) { if (SelectedBranch.id > 0) { Branch i = await BranchRestService.UpdateBranchAsync(mapper, SelectedBranch); if (i.id > 0) { _ = ShowMessageDialg("Branch Update", "Branch Updated Successfully", MsgDialogType.infor); RizeSyncEvent(); } else { _ = ShowMessageDialg("Branch Update", "Can't Save Branch", MsgDialogType.error); return; } } else { _ = ShowMessageDialg("Branch Update", "Please Select Branch Before Update", MsgDialogType.warrning); return; } } else { _ = ShowMessageDialg("Branch Update", "Please Select Branch Before Update", MsgDialogType.warrning); return; } }
private async void SaveBranch() { IRestDataMapper mapper = containerExtension.Resolve <IRestDataMapper>(); if (SelectedBranch.IsValidBranch()) { Branch b = await BranchRestService.CreateBranchAsync(mapper, SelectedBranch); if (b.id > 0) { b.code = $"BRN{b.id}"; b = await BranchRestService.UpdateBranchAsync(mapper, b); if (b.id > 0) { _ = ShowMessageDialg("New Branch Creation", "Branch Created Successfully", MsgDialogType.infor); RizeSyncEvent(); Initialize(); } else { _ = ShowMessageDialg("New Branch Creation", "Can't Branch Code", MsgDialogType.error); return; } } else { _ = ShowMessageDialg("New Branch Creation", "Can't Save Branch", MsgDialogType.error); return; } } else { _ = ShowMessageDialg("New Branch Creation", "Invalid Branch Details or Already Exist Branch", MsgDialogType.warrning); return; } }