public ActionResult <UserModel> Find(BackUpModel user) { (bool, UserModel)isSuccessful = _userRepo.Find(user); if (isSuccessful.Item1) { return(Ok(isSuccessful.Item2)); } return(NotFound()); }
private void button1_Click(object sender, EventArgs e) { string path = System.AppDomain.CurrentDomain.BaseDirectory; BackUpModel model = new BackUpModel(); model.destDBFileName = @"DataBase\SHOEDB.db"; model.backupDBFileName = @"BuckUp\SHOEDB.db"; BackUpDateBase myBackUpDateBase = new BackUpDateBase(); myBackUpDateBase.Initializae(model); myBackUpDateBase.BackupDB(); MessageBox.Show("OK"); }
internal (bool, UserModel) Find(BackUpModel user) { bool isSuccessful = true; UserModel userModel = _dbContext.Users.Where(e => (e.Email == user.Email && e.BackupQuestion == user.BackupQuestion && e.BackupAnswer == user.BackupAnswer)).FirstOrDefault(); if (userModel is null) { isSuccessful = false; return(isSuccessful, userModel); } return(isSuccessful, userModel); }
//数据备份 private void t_btn_DataBackup_Click(object sender, EventArgs e) { try { string path = System.AppDomain.CurrentDomain.BaseDirectory; BackUpModel model = new BackUpModel(); model.destDBFileName = path + @"DataBase\SHOEDB.db"; model.backupDBFileName = path + string.Format(@"BuckUp\SHOEDB_{0}.db", DateTime.Now.ToShortDateString()); BackUpDateBase myBackUpDateBase = new BackUpDateBase(); myBackUpDateBase.Initializae(model); myBackUpDateBase.BackupDB(); this.Info("备份成功!"); } catch (Exception ex) { this.Warning(ex.Message); } }