コード例 #1
0
        public async Task <Roles> AddOrModifyAsync(AddOrModifyRoles model, string sOperctor)
        {
            Roles entityRoles;

            if (model.Id == 0)
            {
                entityRoles = _Mapper.Map <Roles>(model);
                await _RolesRepository.AppendAsync(entityRoles, sOperctor);
            }
            else
            {
                entityRoles = await _RolesRepository.SelectAsync(model.Id);

                entityRoles = _Mapper.Map(model, entityRoles);
                _RolesRepository.Update(entityRoles, sOperctor);
            }
            await _userRoleService.AddOrDeleteRoleUserAsync(entityRoles.Id, model.lstUserId, sOperctor);

            await _roleMenuService.AddOrDeleteRoleMenuAsync(entityRoles.Id, model.lstMenuId, sOperctor);

            return(entityRoles);
        }