/// <summary> /// 修改部门信息 /// </summary> /// <param name="info"></param> /// <returns></returns> public async Task Modify(OrganizationModifyRequest info) { using (_db) { await _db.ExecSqlNoQuery("delete Role_Organization where OrganizationId=@OrganizationId", new SqlParameter("OrganizationId", info.Id)); await _db.ExecSqlNoQuery("delete Privilege where MasterValue=@MasterValue", new SqlParameter("MasterValue", info.Id)); var organization = await _db.Organization.FindByIdAsync(info.Id); _mapper.Map(info.Organization, organization); _db.ModifyEntity(organization); await SetOtherInfo(_db, info.Id, info.ModuleIds, info.OperateIds, info.RoleIds); await _db.SaveChangesAsync(); } }
/// <summary> /// 修改模块 /// </summary> /// <param name="info"></param> /// <returns></returns> public async Task Modify(ModuleModifyRequest info) { if (info.PId == null) { if (info.Type == (int)ModuleTypeEnum.Menu) { throw new ApiException("顶级目录类型不能为菜单!"); } } using (_db) { var model = await _db.Module.FindByIdAsync(info.Id); _mapper.Map(info, model); _db.ModifyEntity(model); await _db.SaveChangesAsync(); } }