public ResultDto UpdateSite(long id, SiteDto siteDto) { return(Result(() => { var command = new UpdateSiteCommand { SiteId = id, SiteTitle = siteDto.Title, Name = siteDto.Name, IsActive = siteDto.IsActive, IsPublic = siteDto.IsPublic, Description = siteDto.Description, }; CommandDispatcher.Send(command); })); }
/// <summary> /// Executes the update site command. /// </summary> /// <returns>The update site command.</returns> private async Task ExecuteUpdateSiteCommand() { if (IsBusy) { return; } IsBusy = true; UpdateSiteCommand.ChangeCanExecute(); try { if (haccpService.IsConnected() == false) { Page.DismissPopup(); IsBusy = false; Page.DisplayAlertMessage(HACCPUtil.GetResourceString("EnableNetworkConnection"), HACCPUtil.GetResourceString( "YourequireanactiveInternetconnectiontoperformsomefunctionsWerecommendthatyouenableWiFiforthispurposeDatachargesmayapplyifWiFiisnotenabled")); return; } if (!pendingCheckListToUpload && !pendingTemperatureRecordsToUpload) { Page.ShowProgressIndicator(); var res = await haccpService.DownloadSiteAndSettings(false); if (Device.OS == TargetPlatform.WinPhone || Device.OS == TargetPlatform.WinPhone) { await Task.Delay(500); } if (res.IsSuccess) { Page.DismissPopup(); IsBusy = false; Page.DisplayAlertMessage("", HACCPUtil.GetResourceString("SiteandSettingsupdatedsuccessfully")); } else { Page.DismissPopup(); IsBusy = false; Page.DisplayAlertMessage("", res.Message); } } else { IsBusy = false; Page.DismissPopup(); await Page.ShowAlert(string.Empty, HACCPUtil.GetResourceString("UploadRecordsPendingOnUpdateSiteSettingsMessage")); } } catch (Exception ex) { Debug.WriteLine("Ooops! Something went wrong while fetch users from server. Exception: {0}", ex); } finally { IsBusy = false; Page.DismissPopup(); UpdateSiteCommand.ChangeCanExecute(); } }