/// <summary> /// 新增学生信息 /// </summary> /// <param name="webModel">编辑页视图Model</param> /// <param name="context">数据库连接上下文对象</param> /// <returns></returns> public async Task <bool> InsertStudentAsync(StudentEditViewModel webModel, ApplicationDbContext context) { try { //Add the student Data var model = await BasicRepository.InsertAsync(webModel, context); if (model.Id == -1) { return(false); } //Make the transaction commit var index = await context.SaveChangesAsync(); return(index == 1); } catch (Exception ex) { _logger.LogError("创建新职工失败:{0},\r\n内部错误详细信息:{1}", ex.Message, ex.InnerException.Message); return(false); } }