示例#1
0
        /// <summary>
        ///删除学生信息
        /// </summary>
        /// <param name="id">学生编号</param>
        /// <param name="context">数据库连接上下文对象</param>
        /// <returns></returns>
        public async Task <bool> DeleteStudentAsync(long id, ApplicationDbContext context)
        {
            try
            {
                //Delete staff Data
                await BasicRepository.DeleteStaffAsync(id, context);

                //Add Operate Information
                var operate = string.Format("删除学生数据,学生编号:{0}", id);
                PSURepository.InsertRecordAsync("IdentityUser", "BasicDomain", "DeleteStudentAsync", operate, (short)PSURepository.OperateCode.Delete, id, context);

                var index = await context.SaveChangesAsync();

                return(index == 2);
            }
            catch (Exception ex)
            {
                _logger.LogError("删除学生失败:{0},\r\n内部错误信息:{1}", ex.Message, ex.InnerException.Message);
                return(false);
            }
        }