Esempio n. 1
0
 /// <summary>
 /// 判断班级是否已经存在
 /// </summary>
 /// <param name="name"></param>
 /// <returns></returns>
 public static bool IsCunZai(string name, int GradeID, int SchoolID)
 {
     using (FaceContext FC = new FaceContext()) {
         var result = FC.Set <Class>().Any(i => i.Name == name && i.SchoolID == SchoolID && i.GradeID == GradeID && i.IsDelete == false);
         return(result);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// 异步保存,第二个参数意思是:不是每一次添加都要保存,可以先add进去,再一起保存
 /// </summary>
 /// <param name="t">要保存的对象</param>
 /// <param name="isSave">是否保存</param>
 /// <returns></returns>
 public async Task CreatAsync(T t, bool isSave)
 {
     _db.Set <T>().Add(t);
     if (isSave)
     {
         await _db.SaveChangesAsync();
     }
 }