Exemplo n.º 1
0
        /// <inheritdoc />
        /// <summary>
        /// 删除公告数据
        /// </summary>
        /// <param name="id">公告编号</param>
        /// <param name="context">数据库上下文对象</param>
        /// <returns></returns>
        public async Task <bool> DeleteBulletinAsync(long id, ApplicationDbContext context)
        {
            try
            {
                //Delete Bulletin Data
                await HomeRepository.DeleteAsync(id, context);

                //Add Operate Information
                var operate = string.Format("删除公告数据,公告Id:{0}", id);
                PSURepository.InsertRecordAsync("Bulletin", "HomeDomain", "DeleteBulletinAsync", operate, (short)PSURepository.OperateCode.Delete, id, context);

                var index = await context.SaveChangesAsync();

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