/// <summary>
        /// 添加
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        public async Task Add(OperateAddRequest info)
        {
            using (_db)
            {
                Operate model = _mapper.Map <Operate>(info);
                //BeforeAdd(model);
                await _db.Operate.AddAsync(model);

                await _db.SaveChangesAsync();
            }
        }
Exemple #2
0
        /// <summary>
        /// 添加模块
        /// </summary>
        public async Task Add(ModuleAddRequest info)
        {
            if (info.PId == null)
            {
                if (info.Type == (int)ModuleTypeEnum.Menu)
                {
                    throw new ApiException("顶级目录类型不能为菜单!");
                }
            }
            using (_db)
            {
                Domain.Module model = _mapper.Map <Domain.Module>(info);
                await _db.AddEntityAsync(model);

                await _db.SaveChangesAsync();
            }
        }