/// <summary> /// Command method to delete the user /// </summary> /// <param name="param"></param> public void OnDeleteUser(object param) { try { MessageBoxResult messageResult = CommonHelper.ShowConfirmationMessage("Do you really want to delete the salected entry (with id:" + SelectedUserModel.Id + ")?"); if (messageResult == MessageBoxResult.Yes) { worker = new BackgroundWorker() { WorkerReportsProgress = true }; worker.DoWork += async(sender, e) => { var result = await userApi.DeleteUser(SelectedUserModel.Id); if (result == (int)Status.DeletedOK) { CommonHelper.ShowInfoMessage("Selected user has been deleted successfully!"); OnGetUsers(Convert.ToString(Pages.Current)); log.Info("Record with id " + SelectedUserModel.Id + " has been deleted successfully"); StatusText = "User record has been deleted successfully!!"; } else { CommonHelper.ShowErrorMessage((Status)result); } }; worker.RunWorkerAsync(); } } catch (Exception ex) { log.Error("Exception : " + ex.Message); CommonHelper.ShowErrorMessage(); } }